var labels = Array('translatex', 'translatey', 'translatez', 'scalex', 'scaley', 'scalez', 'rotatex', 'rotatey', 'rotatez');
var arr1 = Array(0, 0, 0, 1, 1, 1, 0, 0, 0);
var arr2 = Array(400, 300, -444, 4, 2, 2, 145, 145, 45);
// calculate timers
function calculate_timers(selector,labels,a1,a2,duration,step){
// duration is animation length in ms
// step is how often you want to run it during animation
// loop through array
var timers = Array();
for(i=0;i<a1.length;i++){
// get difference
if((parseInt(a2[i]) - parseInt(a1[i])) != 0){
// they are not the same so get the difference and figure out the
var d = parseFloat(parseFloat(a2[i]) - parseFloat(a1[i]));
var t = parseFloat(duration/step);
var inc = parseFloat(Math.abs(d)/t);
var it = i;
//alert(labels[i] + ' change by ' + inc + ' every ' + step + 'ms');
// loop the timers
var string_function = function(it,inc){
var newvalue = parseFloat(parseFloat($(selector).attr('cssattr_' + labels[it])) + parseFloat(inc));
newvalue = newvalue.toFixed(2);
$(selector).attr('cssattr_' + labels[it],newvalue);
$('#cssattr_' + labels[it]).text(labels[it] + ": " + newvalue);
$(selector).css('-webkit-transform','translateX(' + $(selector).attr('cssattr_translatex')+'px) translateY(' + $(selector).attr('cssattr_translatey')+'px) translateZ(' + $(selector).attr('cssattr_translatez')+'px) scaleX(' + $(selector).attr('cssattr_scalex')+') scaleY(' + $(selector).attr('cssattr_scaley') + ') scaleZ(' + $(selector).attr('cssattr_scalez')+') rotateX(' + $(selector).attr('cssattr_rotatex')+'deg) rotateY(' + $(selector).attr('cssattr_rotatey')+'deg)...
Please Whitelist JSFiddle in your content blocker.
Help keep JSFiddle free for always by one of two ways:
Whitelist JSFiddle in your content blocker (two clicks)
Go PRO and get access to additional PRO features →
Join the 4+ million users, and keep the JSFiddle dream alive.
Ad-free
All ads in the editor and listing pages are turned completely off.
Use pre-released features
You get to try and use features (like the Palette Color Generator) months before everyone else.
Fiddle collections
Sort and categorize your Fiddles into multiple collections.
Private collections and fiddles
You can make as many Private Fiddles, and Private Collections as you wish!
Console
Debug your Fiddle with a minimal built-in JavaScript console.