Friday, March 3, 2017

After Efffects swing (real world physics)

Make sure the "center" of the object, or where you want it to swing from, is the 0,0 (or whatever) anchor point.

ADD to rotation:

// Inertial Bounce (moves settle into place after bouncing around a little)
n = 0;
if (numKeys > 0) {
n = nearestKey(time).index;
if (key(n).time > time){
n--;
}
}
if (n == 0) {
t = 0;
} else {
t = time - key(n).time;
}
if (n > 0){
v = velocityAtTime(key(n).time - thisComp.frameDuration/10);
amp = 8;
freq = 2.0;
decay = 6.0;
value + (v/100)*amp*Math.sin(freq*t*2*Math.PI)/Math.exp(decay*t);
}else{
value;
}

Wednesday, September 26, 2012

After Effects Number Rolling

Alt + Shift + "=" to open the expression panel with the "text" transform effect open.

numDecimals = 0;
commas = true;
dollarSign = true;
millSuff = true;
beginCount = 10;
endCount = 110;
dur = .85;
t = time - inPoint;
s = linear (t, 0, dur, beginCount, endCount).toFixed(numDecimals);
prefix = "";
suffix = "";
if (s[0] == "-") { prefix = "-"; s = s.substr(1); }
if (dollarSign) prefix += "$";
if (millSuff) suffix += " MILLION";
if (commas) {
decimals = "";
if (numDecimals > 0){
decimals = s.substr(-(numDecimals + 1));
s = s.substr(0,s.length - (numDecimals + 1));
}
outStr = s.substr(-s.length, (s.length-1)%3 +1);
for (i = Math.floor((s.length-1)/3); i > 0; i--) {
outStr += "," + s.substr(-i*3,3);
}
prefix + outStr + decimals + suffix;
}
else
{
prefix + s + suffix;
}



Thursday, November 17, 2011

Flash Image smoothing

Sometime we have to resize JPGs in Flash on a "loadMovie" script by making the target scale - just because. However, this usually makes the image jagged and pixelated - hate it!

So let's fix it. I found this here:

import flash.display.*;

function loadBitmapSmoothed(url:String, target:MovieClip) {
// Create a movie clip which will contain our
// unsmoothed bitmap
var bmc:MovieClip = target.createEmptyMovieClip(
"bmc",
target.getNextHighestDepth());

// Create a listener which will notify us when
// the bitmap loaded successfully
var listener:Object = new Object();

// Track the target
listener.tmc = target;

// If the bitmap loaded successfully we redraw the
// movie into a BitmapData object and then attach
// that BitmapData to the target movie clip with
// the smoothing flag turned on.
listener.onLoadInit = function(mc:MovieClip) {
mc._visible = false;

var bitmap:BitmapData = new BitmapData(
mc._width,
mc._height,
true);

this.tmc.attachBitmap(
bitmap,
this.tmc.getNextHighestDepth(),
"auto",
true);

bitmap.draw(mc);
};

// Do it, load the bitmap now
var loader:MovieClipLoader = new MovieClipLoader();
loader.addListener(listener);
loader.loadClip(url, bmc);
}


Then all that is left to do is add:

createEmptyMovieClip("myMC",getNextHighestDepth());
loadBitmapSmoothed("mypic.jpg",myMC);



Wednesday, October 19, 2011

More Wiggle

Just moves on the Y-axis

With the object selected, choose the parameter you want to effect (e.g. position, scale, anchor point, etc.)

w = wiggle(.2,100);
// Above is my variable "w" that will hold my wiggle (home many times per second, how much)
[value[0],w[1],value[2]]
// 0 = x-axis, 1 = y-axis, 2 = z-axis
// "value" says just hold the normal value

Thursday, September 29, 2011

H.264 Codec settings

I've been struggling to get my Adobe Media Encoder to make H.264 videos right for the iPhone 3. It was working on the iPhone 4. Just learned some "default" settings are incorrect. Found this:

"When encoding, please make sure you are using H.264 Baseline Profile Level 3.0 or lower with no more than three reference frames, AAC Low Complexity Profile, and an MP4 container if you want to support older iProducts."

Wednesday, September 28, 2011

AfterEffects MotionScript - "random" position

Wiggle is a cool little function in AfterEffects.

Clicking on the "transform parameter" select SHIFT+ALT "=", Animation > Add Expression. Then past this:

wiggle(.2,25)

The first value is the frequency, the second is the amount/change.

AfterEffect MotionScript - Random Scale

segMin = .75; //minimum segment duration
segMax = 1.25; //maximum segment duration
minVal = 5;
maxVal = 10;

end = 0;
j = 0;
while ( time >= end){
j += 1;
seedRandom(j,true);
start = end;
end += random(segMin,segMax);
}
s = random(minVal,maxVal);
endVal = [s,s];
seedRandom(j-1,true);
dummy=random(); //this is a throw-away value
s = random(minVal,maxVal);
startVal = [s,s]
ease(time,start,end,startVal,endVal)

Tuesday, June 14, 2011

Mobile Browser Detect

This is a great PHP script to detect the type of device that is visiting your site and redirecting to a different version. It detects all major phone operating systems (android, iphone, blackberry, windows, etc.). The script is free for non-profit and only $50 if your company is for profit.

Monday, June 6, 2011

HTML5 Fonts

Great resource for generating CSS and all font files needed for HTML5 broswers:

http://www.fontsquirrel.com/fontface/generator

MySQL Joins made Simple

Sometimes JOINs in MySQL can get confusing. This article will help make it super simple for you!

INNER_JOIN.png

This is the simplest, most understood Join and is the most common. This query will return all of the records in the left table (table A) that have a matching record in the right table (table B).


Tuesday, February 1, 2011

Force IE6, IE7 and IE8 to be more compliant

Pretty cool project going on that forces older versions of IE to be more compliant. It relies on javascript to allow for some of the newer CSS styling (but not all). It even has a transparent PNG fix for IE 6.

Target IE6 and IE7 with CSS

Very nice way to target IE6 or IE7 specifically within your CSS doc.

#myelement
{ color: #999; /* shows in all browsers */ 
*color: #999; /* notice the * before the property - shows in IE7 and below */ 
_color: #999; /* notice the _ before the property - shows in IE6 and below */ 
}

Thursday, June 24, 2010

Flash Actionscript Tweening

function tween(mc, what, easeType, begin, end, time, then, onWhat) {
if (easeType == 1) {
myEase = Regular.easeInOut;
} else if (easeType == 2) {
myEase = Strong.easeInOut;
} else if (easeType == 3) {
myEase = Regular.easeOut;
} else if (easeType == 4) {
myEase = Strong.easeOut;
} else if (easeType == 5) {
myEase = Regular.easeIn;
} else if (easeType == 6) {
myEase = Strong.easeIn;
} else if (easeType == 7) {
myEase = None.easeNone;
} else if (easeType == 8) {
myEase = Back.easeOut;
}

var myTween:Tween = new Tween(mc, what, myEase, begin, end, time, false);
myTween.onMotionFinished = function() {
if (then != null) {
then.call();
}
//this.yoyo();
};

};

Friday, February 5, 2010

IE6: Removing Padding on Input Checkbox

If you've ever put a background on an input checkbox and viewed it in IE6, you'll notice there is padding around the checkbox. Other browsers don't have this padding, and it can ruin designs if not dealt with.

An easy way to get rid of the padding through CSS is by adding these styles to the checkbox:

margin:0; width:13px; height:13px; overflow:hidden;

Doing this will not affect any other browser (at least modern ones) and will fix your IE6 issues.

Thursday, February 4, 2010

Images in LABEL tag no clickable in IE

Internet Explorer doesn't allow your images that are within a LABEL tag to be clickable. There is a javascript hack fix for this that works for sure in IE6-8. Sometimes you need, for usability, to have your images work like text in the LABEL tag, this is how you can accomplish this in IE.

Note that all other browsers do this fine...

Wednesday, December 16, 2009

My Flash to EXE fullscreen scalling settings

The new version of Flash Player when rendering an EXE document doesn't want to obey the "fscommand" for some reason. I don't know why, I don't care. This works just fine:

fscommand("fullscreen", true);
fscommand("allowscale", false);
fscommand("showmenu", false);
Stage.scaleMode = "showAll";

Thursday, December 3, 2009

CSS Selectors Browser Compatibility

Compatibility is one of the most annoying parts of web scripting and programming. I've found a great reference when it comes to CSS selectors. This should help you figure out what will work in old browsers and what you'll need to find a workaround for.

Wednesday, December 2, 2009

Hiding Text on Form Submit Button

I wanted to have CSS replace a submit button for one of the forms on my site. So I decided to style it with a background image and set a text-indent to hide the text. It worked nice but in Internet Explorer, the text wouldn't go away.

I found a strange way to make the text disappear even in Explorer. Just use this bit of CSS for the submit button.

{
color: transparent;
text-transform: capitalize;
}


That should do the trick!

Tuesday, November 17, 2009

Mute Streaming Audio in Flash

Muting sounds that are streaming in Flash isn't as simple as changing the volume of an object via a "mute" button. But it is surprisingly EASY! I can't believe I didn't see it. AND the movie continues to play and unmuting just brings the sound back in.... duh!

Well, I searched and searched and finally found something. Thanks (http://www.actionscript.org/forums/showthread.php3?t=32982)! I made some simple modifications.

This is my code. I made a MC with 2 frames and buttons in it. In frame 1, a button that calls "mute();" here's the button code for the one that's in frame 1.

on (release) {
nextFrame();
this._parent.mute();
}
And frame 2 has this:

on(release) {
prevFrame();
this._parent.unmute();
}

And here's the code in the root. I could easily make a volume slider that sets the "level" variable, and would then set. But for most stuff, we simply need the sound to be either there... or not.

level = 100;
globalSound = new Sound();
globalSound.setVolume(level);

function mute() {
trace("mute");
//previewaudio.stop();
globalSound.setVolume(0);
}
function unmute() {
trace("unmute");
globalSound.setVolume(100);
}

Enjoy!

Monday, October 19, 2009

Vertical Ticker Scroll with jQuery

Ever wanted to make those cool vertical scroll things? Here is a great light weight way to accomplish it: