Skip to content

Instantly share code, notes, and snippets.

View seblavoie's full-sized avatar

Sébastien Lavoie seblavoie

View GitHub Profile
@seblavoie
seblavoie / gist:e3cc7e59b4b0ebc5df9b
Last active November 13, 2015 16:16
Color alteration in After Effects
var _sourceColor, _hslColor, _hue, _saturation, _lightness; _sourceColor = effect("Fill")("Color"); _hslColor = rgbToHsl(_sourceColor); _hue = _hslColor[0]; _saturation = _hslColor[1]; _lightness = _hslColor[2] - .2; // Here you go hslToRgb([_hue, _saturation, _lightness, 1]);
@seblavoie
seblavoie / .bash_profile
Created September 28, 2012 19:21
Plain text directory structure creation in bash
# Creates folder structure from plain text.
# Based on this stackoverflow question and answer http://stackoverflow.com/questions/12642260/better-bash-script-to-create-directory-structure
mkdirs($file) {
sed -f mkdirs.sed $file | xargs mkdir -p
}
@seblavoie
seblavoie / slider-texts-switcher.js
Last active October 11, 2015 13:28
Switch texts or images with a slider
// Replace _slider by your own slider
// Parsing single string
// Paste this expression in Source Text attribute
// Source Text: "French | English | Spanish"
_slider = comp("# Animation").layer("CONTROLLER").effect("Language")("Slider");
value.split(" | ")[Math.floor(_slider)];
// Navigating through frames
// Time remap composition containing multiple single frames layers
@seblavoie
seblavoie / animation-expressions.js
Last active March 3, 2017 03:05
Useful animation expressions
// Link with expression
l = thisComp.layer("Layer Name");
p = l.toWorld(l.anchorPoint)
// Opacity jittering in
transitionTime = 1;
if (time < transitionTime) {
(random() < 0.5 ? 0 : 100);
} else {
100;
@seblavoie
seblavoie / demo_movie-countdown.jsx
Created November 27, 2012 15:48
AeTuts+ movie countdown script
{
app.beginUndoGroup("Demo Script");
// Creating project
var currentProject = (app.project) ? app.project : app.newProject();
// Creating comp
var compSettings = cs = [1280, 720, 1, 10, 24];
var defaultCompName = "Demo"
var currentComp = (currentProject.activeItem) ? currentProject.activeItem : currentProject.items.addComp(defaultCompName, cs[0], cs[1], cs[2], cs[3], cs[4]);
@seblavoie
seblavoie / range.jsx
Created November 29, 2012 05:36
After Effect text number range
{
app.beginUndoGroup("Script");
compSettings = cs = [1280, 720, 1, 1, 24];
currentProject = (app.project) ? app.project : app.newProject();
currentComp = (currentProject.activeItem) ? currentProject.activeItem : currentProject.items.addComp("Timeline", cs[0], cs[1], cs[2], cs[3], cs[4]);
currentComp.openInViewer();
textLayer = currentComp.layers.addText("Range");
textLayerSourceTextProperty = textLayer.property("Source Text");
// Use to call views with self contained javascript function using backend
(function(){
$("[data-ajax-url]:not(.disabled)").on("click", function(e){
callAjaxScript(
$(this).attr("data-ajax-url"),
$(this).attr("data-ajax-type") || "get",
$(this).attr("data-ajax-data") || "");
});
})();
@seblavoie
seblavoie / .bash_profile
Last active December 11, 2015 11:38
After Effects command line aliases for Windows
# Adobe After Effects command line aliases
# Change this according to your version
AEVERSION="CS6"
# OSX
AEPATH="/Applications/Adobe After Effects ${AEVERSION}/aerender"
# Windows
AEPATH="C:/Program Files/Adobe/Adobe After Effects ${AEVERSION}/Support Files/aerender.exe"
@seblavoie
seblavoie / update-url.sql
Created February 8, 2013 18:36
Update wordpress URL
UPDATE wp_posts SET wp_posts.guid=REPLACE(wp_posts.guid,
'olddomain.com',
'newdomain.com'
);
UPDATE wp_options SET wp_options.option_value='http://newdomain.com' WHERE wp_options.option_name='siteurl' OR wp_options.option_name='home';
@seblavoie
seblavoie / copy-folder-structure.sh
Last active December 17, 2015 07:58
Bash line to copy folder structure only (not files) contained in current folder. Inspired by: http://www.linuxquestions.org/questions/linux-newbie-8/copy-directory-structure-only-208796/.
# Run from source folder’s root.
find . -type d -exec mkdir ../destination-folder-name/{} \;