IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

JavaScript Discussion :

Librairie JS home made + chrome


Sujet :

JavaScript

  1. #1
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut Librairie JS home made + chrome
    Bonjour,

    je suis en train de créer une petite lib js pour le développement web orienté js/ajax,
    elle vaut ce qu'elle vaut, peut-être contient-elle des abbérations vous pouvez me faire des retours dessus,
    mais en tout cas je rencontre un problème de memory leaks sur chrome mac, et seulement cette application, ce seulement quand j'anime des fonts en taille ou couleur, rotation css et autres
    y a-t-il à votre connaissance un bug de blink, le moteur de chrome, à ce sujet?

    l'adresse ou vous pouvez voir le test en question est http://lib-js.com
    bon vous pouvez pomper la lib, elle sera gratuite, mais elle est encore en beta!

    merci
    bonne soirée

    ps: la lib en question supportera la génération et l'animation svg, dont l'animation entre plusieurs formes vectorielles, et supporte déjà les animations css jusqu'à css3 avec conversion d'unités et aussi des animations par courbes polynomiales de bezier

    merci de ne pas poster le code sur github ou autre, il est encore en beta
    0x4F

  2. #2
    Expert éminent
    Avatar de Watilin
    Homme Profil pro
    En recherche d'emploi
    Inscrit en
    Juin 2010
    Messages
    3 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : En recherche d'emploi

    Informations forums :
    Inscription : Juin 2010
    Messages : 3 093
    Points : 6 754
    Points
    6 754
    Par défaut
    Aberration, 1 b, 2 r et pas d'accent. (Merci Monsieur Bescherelle ^.^)

    À propos de tes fuites de mémoires, as-tu utilisé le profileur de la console ? Fais F12 et clique sur l'onglet « Profiles ». Il y a une option « record heap allocations » qui te permet de chasser les fuites. Ça demande peut-être un peu de prise en main mais tu verras, c'est pratique. Si avec cet outil tu ne constates aucun « débordement » de mémoire de ton script, tu pourras supposer que la fuite ne se produit pas dans le moteur d'exécution JavaScript mais plutôt, par exemple, dans le moteur de rendu graphique. Et dans ce cas-là, on pourra soupçonner un bug de Chrome/Mac. Mais n'allons pas trop vite.

    Question idiote, as-tu comparé avec Chrome/Windows ? Et avec un autre navigateur de ton Mac ? Si tu penses qu'il s'agit d'un bug du logiciel, il faut que tu suives la procédure habituelle de rapport de bug : vérifie que ça ne peut pas venir d'une extension (teste avec un profil vierge), si possible, teste sur un autre Mac, etc.

    Sois conscient que ta description du problème est trop vague pour faire un rapport de bug. Tu devrais au moins nous montrer un exemple de bout de code qui pose le problème.
    La FAQ JavaScript – Les cours JavaScript
    Touche F12 = la console → l’outil indispensable pour développer en JavaScript !

  3. #3
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Merci monsieur Watilin et monsieur Bescherelle

    j'ai déjà essayé le profileur, le problème c'est qu'il est très vague sur les allocations mémoire, et que cela ne suffit pas à repérer le problème, dans la mesure où les différences de mémoire affichées sont de tout autre ordre que celles constatées.
    J'ai aussi essayé en vm sous windows 7 et 8, même problème constaté, seul chrome est affecté semble-t-il, ce qui me laisse penser que la faille est du côté de blink.
    On a testé avec un ami sous deux autres macs, et d'autres systèmes comme linux, même problème sous les macs avec chrome, aucun problème sous linux avec chromium qui est sous webkit
    En outre sous chrome, toute animation sur d'autres éléments que les polices de caractères ne pose aucun problème.
    cela met du temps à planter car la mémoire sature progressivement.

    pour le code voici la partie en cause, attention c'est relativement long, je pense que ça l'est trop pour que quelqu'un ait envie de se pencher dessus:

    appel:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
     function changeLetterSize() {
    	    for (var i=1; i<=10; i++) {
    	        if (i<10) {
    		        lib('#_'+i).to({ style: { transform:"rotate("+(Math.random()*90-45)+"deg)" } }, { duration:5000, easing:"easeOutQuad" });
                } else {
                    lib('#_'+i).to({ style: { transform:"rotate("+(Math.random()*90-45)+"deg)" } }, { duration:5000, easing:"easeOutQuad", oncomplete:changeLetterSize });
                }
            }
    }
    changeLetterSize();
    partie du moteur en cause:
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
    817
    818
    819
    820
    821
    822
    823
    824
    825
    826
    827
    828
    829
    830
    831
    832
    833
    834
    835
    836
    837
    838
    839
    840
    841
    842
    843
    844
    845
    846
    847
    848
    849
    850
    851
    852
    853
    854
    855
    856
    857
    858
    859
    860
    861
    862
    863
    864
    865
    866
    867
    868
    869
    870
    871
    872
    873
    874
    875
    876
    877
    878
    879
    880
    881
    882
    883
    884
    885
    886
    887
    888
    889
    890
    891
    892
    893
    894
    895
    896
    897
    898
    899
    900
    901
    902
    903
    904
    905
    906
    907
    908
    909
     
                    animLoop:function() {
    			__.rAF=__.rAnimFrame(__.animLoop);
    			__.timer();
    		},
    		s4:function() {
        		return Math.floor((1+Math.random())* 0x10000).toString(16).substring(1);
      		},
      		guid:function() {
        		return __.s4()+__.s4()+'-'+__.s4()+'-'+__.s4()+'-'+__.s4()+'-'+__.s4()+__.s4()+__.s4();
      		},
    		rAnimFrame:function(callback) {
    			__.lastTime = 0;
    			var vendors = ['webkit', 'moz', 'ms'];
    			for (var x = 0; x<vendors.length && !window.requestAnimationFrame; ++x) {
    				window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
    			}
    			if (!window.requestAnimationFrame) {
    				window.requestAnimationFrame = function(callback, element) {
    					var currTime = new Date().getTime();
    					var timeToCall = Math.max(0, 16 - (currTime - __.lastTime));
    					var id = window.setTimeout(function() { callback(currTime + timeToCall); }, timeToCall);
    					__.lastTime = currTime + timeToCall;
    					return id;
    				};
    			}
    			return window.requestAnimationFrame(callback);
    		},
    		cAnimFrame:function(id) {
    			var vendors = ['webkit', 'moz', 'ms'];
    			for (var x = 0; x<vendors.length && !window.cancelAnimationFrame; ++x) {
    				window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame'] || window[vendors[x]+'CancelRequestAnimationFrame'];
    			}
    			if (!window.cancelAnimationFrame) {
    				window.cancelAnimationFrame = function(id) {
    					clearTimeout(id);
    				};
    			}
    			window.cancelAnimationFrame(id);
    		},
    		timer:function() {
    			if (__.tQ.length>0) {
    				var date=new Date();
    				var m,value,t,v,x,y,z,timeElapsed;
    				t=0;
    				while (t<__.tQ.length) {
    					timeElapsed=date.getTime()-__.tQ[t][1].startTime;
    					if (timeElapsed<__.tQ[t][1].duration) {
    						for (x=0; x<__.tQ[t][0].length; x++) {
    							if (!__.tQ[t][0][x].hasOwnProperty("bezier")) {
    								if (__.isArray(__.tQ[t][0][x].start)) {
    									value="";
    									for (y=0; y<__.tQ[t][0][x].start.length; y++) {
    										if (typeof(__.easing[__.tQ[t][1].easing])!="function") {
    											if (__.isArray(__.tQ[t][0][x].start[y])) {
    												v="";
    												for (z=0; z<__.tQ[t][0][x].start[y].length; z++) {
    													v+=__.tQ[t][0][x].start[y][z].prefix+(__.tQ[t][0][x].start[y][z].value+(__.tQ[t][0][x].end[y][z].value-__.tQ[t][0][x].start[y][z].value)*(timeElapsed/__.tQ[t][1].duration))+(typeof(__.tQ[t][0][x].start[y][z].unit)=="string"?__.tQ[t][0][x].start[y][z].unit:"")+__.tQ[t][0][x].start[y][z].suffix;
    													if (z<__.tQ[t][0][x].start[y].length-1) {
    														v+=__.tQ[t][0][x].separator[y];
    													}
    												}
    											} else if (__.isObject(__.tQ[t][0][x].start[y])) {
    												v={};
    												for (z in __.tQ[t][0][x].start[y]) {
    													v[z]=__.tQ[t][0][x].start[y][z]+(__.tQ[t][0][x].end[y][z]-__.tQ[t][0][x].start[y][z])*(timeElapsed/__.tQ[t][1].duration);
    												}
    											} else {
    												v=__.tQ[t][0][x].start[y]+(__.tQ[t][0][x].end[y]-__.tQ[t][0][x].start[y])*(timeElapsed/__.tQ[t][1].duration);
    											}
    										} else {
    											if (__.isArray(__.tQ[t][0][x].start[y])) {
    												v="";
    												for (z=0; z<__.tQ[t][0][x].start[y].length; z++) {
    													v+=__.tQ[t][0][x].start[y][z].prefix+__.easing[__.tQ[t][1].easing](timeElapsed, __.tQ[t][0][x].start[y][z].value, __.tQ[t][0][x].end[y][z].value-__.tQ[t][0][x].start[y][z].value, __.tQ[t][1].duration)+(typeof(__.tQ[t][0][x].start[y][z].unit)=="string"?__.tQ[t][0][x].start[y][z].unit:"")+__.tQ[t][0][x].start[y][z].suffix;
    													if (z<__.tQ[t][0][x].start[y].length-1) {
    														v+=__.tQ[t][0][x].separator[y];
    													}
    												}
    											} else if (__.isObject(__.tQ[t][0][x].start[y])) {
    												v={};
    												for (z in __.tQ[t][0][x].start[y]) {
    													v[z]=__.tQ[t][0][x].start[y][z]+(__.tQ[t][0][x].end[y][z]-__.tQ[t][0][x].start[y][z])*(timeElapsed/__.tQ[t][1].duration);
    												}
    											} else {
    												v=__.easing[__.tQ[t][1].easing](timeElapsed, __.tQ[t][0][x].start[y], __.tQ[t][0][x].end[y]-__.tQ[t][0][x].start[y], __.tQ[t][1].duration);
    											}
    										}
    										value+=__.prepareValue(v, { unit:__.tQ[t][0][x].unit[y], prefix:__.tQ[t][0][x].prefix[y], suffix:__.tQ[t][0][x].suffix[y], separator:__.tQ[t][0][x].separator[y], treatment:__.tQ[t][0][x].treatment[y] })+" ";
    									}
    									value=value.substr(0, value.length-1);
    									__.affectValue(value, { target:__.tQ[t][0][x].target, properties:__.tQ[t][0][x].properties });
    								}
    							} else {
    								v=__.bezier(__.tQ[t][0][x].start, __.tQ[t][0][x].end, __.tQ[t][0][x].bezier, timeElapsed/__.tQ[t][1].duration);
    								value=__.prepareValue(v, { unit:__.tQ[t][0][x].unit, prefix:__.tQ[t][0][x].prefix, suffix:__.tQ[t][0][x].suffix, separator:__.tQ[t][0][x].separator, treatment:__.tQ[t][0][x].treatment });
    								__.affectValue(value, { target:__.tQ[t][0][x].target, properties:__.tQ[t][0][x].properties });
    							}
    						}
    					}
    					t++;
    				}
    				value=null, v=null, date=null;
    			} else {
    				__.cAnimFrame(__.rAF);
    				__.rAFinitiated=false;
    			}
    		},
    		timerComplete:function(uuid) {
    			var v,value,t=0;
    			while (t<__.tQ.length) {
    				if (__.tQ[t][2]===uuid) {
    					var m=__.tQ[t];
    					__.tQ.splice(t,1);
    					for (x=0; x<m[0].length; x++) {
    						if (!m[0][x].hasOwnProperty("bezier")) {
    							if (__.isArray(m[0][x].start)) {
    								value="";
    								for (y=0; y<m[0][x].start.length; y++) {
    									if (__.isArray(m[0][x].start[y])) {
    										v="";
    										for (z=0; z<m[0][x].start[y].length; z++) {
    											v+=m[0][x].start[y][z].prefix+m[0][x].end[y][z].value+(typeof(m[0][x].start[y][z].unit)=="string"?m[0][x].start[y][z].unit:"")+m[0][x].start[y][z].suffix;
    											if (z<m[0][x].start[y].length-1) {
    												v+=m[0][x].separator[y];
    											}
    										}
    									} else if (__.isObject(m[0][x].start[y])) {
    										v={};
    										for (z in m[0][x].start[y]) {
    											v[z]=m[0][x].end[y][z];
    										}
    									} else {
    										v=m[0][x].end[y];
    									}
    									value+=__.prepareValue(v, { unit:m[0][x].unit[y], prefix:m[0][x].prefix[y], suffix:m[0][x].suffix[y], separator:m[0][x].separator[y], treatment:m[0][x].treatment[y] })+" ";
    								}
    								value=value.substr(0, value.length-1);
    								__.affectValue(value, { target:m[0][x].target, properties:m[0][x].properties });
    							}
    						} else {
    							value=__.prepareValue(m[0][x].end, { unit:m[0][x].unit, prefix:m[0][x].prefix, suffix:m[0][x].suffix, separator:m[0][x].separator, treatment:m[0][x].treatment });
    							__.affectValue(value, { target:m[0][x].target, properties:m[0][x].properties });
    						}
    					}
    					if (typeof(m[1].oncomplete)=="function") {
    						if (!__.isArray(m[1].oncompleteparams)) {
    							m[1].oncomplete();
    						} else {
    							m[1].oncomplete.apply(this, m[1].oncompleteparams);
    						}
    					}
    					break;
    				} else {
    					t++;
    				}
    			}
    		},
    		prepareValue:function(v, obj) {
    			if (__.isObject(v)) {
    				if (v.hasOwnProperty("r") && v.hasOwnProperty("g") && v.hasOwnProperty("b") && v.hasOwnProperty("a")) {
    					v=obj.treatment(v.r)+obj.separator+obj.treatment(v.g)+obj.separator+obj.treatment(v.b)+obj.separator+v.a;
    				}
    			} else {
    				if (typeof(obj.treatment)=="function") {
    					v=obj.treatment(v);
    				}
    			}
    			if (typeof(obj.prefix)=="string") {
    				v=obj.prefix+v;
    			}
    			if (typeof(obj.unit)=="string") {
    				v=v+obj.unit;
    			}
    			if (typeof(obj.suffix)=="string") {
    				v=v+obj.suffix;
    			}
    			return v;
    		},
    		affectValue:function(v, obj) {
    			if (v.indexOf("NaN")==-1) {
    				__.setPropertyValueDeep(v, obj.target, obj.properties);
    			}
    		},
    		from:function(values, parameters, elms) {
    			var properties=__.getPropertiesContainingValues(values, null);
    			var i, j, k, l, p, q, r, s, t, u, props;
    			for (i=0; i<__.tQ.length; i++) {
    				for (j=0; j<__.tQ[i][0].length; j++) {
    					for (p in properties) {
    						props=__.implode(',', properties[p]);
    						if (elms.indexOf(__.tQ[i][0][j].target)!=-1 && props==__.implode(',', __.tQ[i][0][j].properties)) {
    							__.tQ[i][0].splice(j--, 1);
    							break;
    						}
    					}
    				}
    				if (__.tQ[i][0].length===0) {
    					__.tQ.splice(i--, 1);
    				}
    			}
    			parameters.duration=(parameters.hasOwnProperty("duration"))?parameters.duration:500;
    			parameters.easing=(parameters.hasOwnProperty("easing"))?parameters.easing:false;
    			parameters.oncomplete=(parameters.hasOwnProperty("oncomplete"))?parameters.oncomplete:false;
    			parameters.oncompleteparams=(parameters.hasOwnProperty("oncompleteparams"))?parameters.oncompleteparams:null;
    			parameters.startTime=new Date().getTime();
    			var toAnimate=[];
    			var start, end, startPrefixes, endPrefixes, currentPrefix, currentSuffix, notModified;
    			for (var prop in values) {
    				if (prop=="style") {
    					for (var setting in values.style) {
    						if (typeof(values.style[setting])!="object") {
    							r=typeof(values.style[setting])=="string"?values.style[setting].split(" "):[values.style[setting].toString()];
    							setting=__.verifySettingVariants(setting);
    							i=0;
    							while (i<r.length) {
    								if (r[i].indexOf("(")!=-1 && r[i].indexOf(")")==-1) {
    									r[i]+=r[i+1];
    									r.splice(i+1,1);
    								} else {
    									i++;
    								}
    							}
    							t=[];
    							for (j=0; j<elms.length; j++) {
    								if (!t.hasOwnProperty(j)) {
    									t[j]={ start:[], end:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    								}
    								cs=__.getStyle(elms[j], setting);
    								s=cs.split(" ");
    								k=0;
    								while (k<s.length) {
    									if (s[k].indexOf("(")!=-1 && s[k].indexOf(")")==-1) {
    										s[k]+=s[k+1];
    										s.splice(k+1,1);
    									} else {
    										k++;
    									}
    								}
    							}
    							if (s.length>0) {
    								if (r.length==s.length) {
    									currentSuffix="";
    									for (i=0; i<r.length; i++) {
    										start=__.getValueAndPrepareForAnimation(r[i]);
    										for (j=0; j<elms.length; j++) {
    											currentPrefix="";
    											end=__.getValueAndPrepareForAnimation(s[i]);
    											if (end.prefix==start.prefix) {
    												if (start.animatable && end.animatable) {
    													t[j].start.push(start.value);
    													t[j].end.push((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, end.value, end.unit, start.unit)):end.value);
    													t[j].unit.push(end.unit);
    													t[j].prefix.push(currentPrefix==""?end.prefix:currentPrefix+" "+end.prefix);
    													t[j].suffix.push(end.suffix);
    													t[j].separator.push(end.separator);
    													t[j].treatment.push(end.treatment);
    													currentPrefix="";
    												} else if (!start.animatable && end.animatable) {
    													if (__.isArray(end.value)) {
    														t[j].start.push([]);
    														for (l=0; l<end.value.length; l++) {
    															t[j].start[t[j].start.length-1].push({ value:0, unit:end.value[l].unit, prefix:end.value[l].prefix, suffix:end.value[l].suffix, separator:end.value[l].separator, treatment:end.value[l].treatment });
    														}
    													} else {
    														t[j].start.push(0);
    													}
    													t[j].end.push(end.value);
    													t[j].unit.push(start.unit);
    													t[j].prefix.push(currentPrefix==""?start.prefix:currentPrefix+" "+start.prefix);
    													t[j].suffix.push(start.suffix);
    													t[j].separator.push(start.separator);
    													t[j].treatment.push(start.treatment);
    													currentPrefix="";
    												} else if (start.animatable && !end.animatable) {
    													t[j].start.push(start.value);
    													if (__.isArray(start.value)) {
    														t[j].end.push([]);
    														for (l=0; l<start.value.length; l++) {
    															t[j].end[t[j].end.length-1].push({ value:0, unit:start.value[l].unit, prefix:start.value[l].prefix, suffix:start.value[l].suffix, separator:start.value[l].separator, treatment:start.value[l].treatment });
    														}
    													} else {
    														t[j].end.push(0);
    													}
    													t[j].unit.push(start.unit);
    													t[j].prefix.push(currentPrefix==""?end.prefix:currentPrefix+" "+start.prefix);
    													t[j].suffix.push(start.suffix);
    													t[j].separator.push(start.separator);
    													t[j].treatment.push(start.treatment);
    													currentPrefix="";
    												} else {
    													if (t[j].suffix.length>0) {
    														t[j].suffix[t[j].suffix.length-1]+=end.value;
    													} else {
    														currentPrefix=end.value;
    													}
    												}
    											} else {
    												currentSuffix+=(end.animatable?" "+s[i]:"");
    												t[j].start.push(start.value);
    												if (__.isArray(start.value)) {
    													t[j].end.push([]);
    													for (l=0; l<start.value.length; l++) {
    														t[j].end[t[j].end.length-1].push({ value:0, unit:start.value[l].unit, prefix:start.value[l].prefix, suffix:start.value[l].suffix, separator:start.value[l].separator, treatment:start.value[l].treatment });
    													}
    												} else {
    													t[j].end.push(0);
    												}
    												t[j].unit.push(start.unit);
    												t[j].prefix.push(start.prefix);
    												t[j].suffix.push(start.suffix+(i==r.length-1?currentSuffix:""));
    												t[j].separator.push(start.separator);
    												t[j].treatment.push(start.treatment);
    											}
    										}
    									}
    									for (j=0; j<elms.length; j++) {
    										toAnimate.push({ 
    											target:elms[j],
    											properties:["style", setting],
    											start:t[j].start,
    											end:t[j].end,
    											unit:t[j].unit,
    											prefix:t[j].prefix,
    											suffix:t[j].suffix,
    											separator:t[j].separator,
    											treatment:t[j].treatment
    										});
    									}
    								} else if (/[transform|filter]/i.test(setting)) {
    									startPrefixes=[];
    									start=[];
    									for (i=0; i<r.length; i++) {
    										start.push(__.getValueAndPrepareForAnimation(r[i]));
    										startPrefixes.push(start[start.length-1].prefix);
    									}
    									endPrefixes=[];
    									end=[];
    									notModified=[];
    									for (j=0; j<elms.length; j++) {
    										end[j]=[];
    										endPrefixes[j]=[];
    										notModified[j]=[];
    										if (!t.hasOwnProperty(j)) {
    											t[j]={ start:[], end:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    										}
    										for (k=0; k<s.length; k++) {
    											u=__.getValueAndPrepareForAnimation(s[k]);
    											if (startPrefixes.indexOf(u.prefix)==-1) {
    												notModified[j].push(s[k]);
    											} else {
    												end[j][startPrefixes.indexOf(u.prefix)]=u;
    												endPrefixes[j][startPrefixes.indexOf(u.prefix)]=u.prefix;
    											}
    										}
    									}
    									for (j=0; j<elms.length; j++) {
    										for (i=0; i<startPrefixes.length; i++) {
    											if (endPrefixes[j].indexOf(startPrefixes[i])==-1) {
    												k={ value:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    												if (start[i].type="object") {
    													for (p=0; p<end[i].value.length; p++) {
    														k.value[p]={ value:0, unit:start[i].value[p].unit, prefix:start[i].value[p].prefix, suffix:start[i].value[p].suffix, separator:start[i].value[p].separator, treatment:start[i].value[p].treatment };
    													}
    													k.unit=start[i].unit;
    													k.prefix=start[i].prefix;
    													k.suffix=start[i].suffix;
    													k.separator=start[i].separator;
    													k.treatment=start[i].treatment;
    													end[j][i]=k;
    												}
    												endPrefixes[j][i]=startPrefixes[i];
    											}
    										}
    										if (end[j].length==start.length) {
    											currentPrefix="";
    											for (i=0; i<notModified[j].length; i++) {
    												if (notModified[j][i]!="none" && notModified[j][i]!="auto") {
    													currentPrefix+=notModified[j][i]+" ";
    												}
    											}
    											for (i=0; i<start.length; i++) {
    												t[j].start.push(end[j][i].value);
    												t[j].end.push(start[i].value);
    												t[j].unit.push(end[j][i].unit);
    												t[j].prefix.push(currentPrefix==""?start[i].prefix:currentPrefix+start[i].prefix);
    												t[j].suffix.push(start[i].suffix);
    												t[j].separator.push(start[i].separator);
    												t[j].treatment.push(start[i].treatment);
    												currentPrefix="";
    											}
    											toAnimate.push({ 
    												target:elms[j],
    												properties:["style", setting],
    												start:t[j].start,
    												end:t[j].end,
    												unit:t[j].unit,
    												prefix:t[j].prefix,
    												suffix:t[j].suffix,
    												separator:t[j].separator,
    												treatment:t[j].treatment
    											});
    										}
    									}
    								} else {
    									console.log("You are trying to animate between incompatible values for "+setting);
    								}
    							} else {
    								console.log("lib.from: no Element was selected");
    							}
    						} else {
    							if (values.style[setting].hasOwnProperty("value") && values.style[setting].hasOwnProperty("treatment")) {
    								start=__.getValueAndPrepareForAnimation(values.style[setting].value);
    								for (i=0; i<elms.length; i++) {
    									end=__.getValueAndPrepareForAnimation(__.getStyle(elms[i], setting));
    									toAnimate.push({ 
    										target:elms[i], 
    										properties:["style", setting], 
    										start:[start.value],
    										end:[((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, end.value, end.unit, start.unit)):end.value)],
    										unit:[start.unit], 
    										prefix:[start.prefix],
    										suffix:[start.suffix], 
    										separator:[start.separator], 
    										treatment:[values.style[setting].treatment]
    									});
    								}
    							} else if (values.style[setting].hasOwnProperty("start") && values.style[setting].hasOwnProperty("b1")) {
    								for (i=0; i<elms.length; i++) {
    									var bezier=[];
    									start=__.getValueAndPrepareForAnimation(values.style[setting].start);
    									for (p in values.style[setting]) {
    										if (p!="start") {
    											j=__.getValueAndPrepareForAnimation(values.style[setting][p]);
    											bezier.push((j.unit!=start.unit)?__.getValue(__.convertUnits(elms[i], setting, j.value, j.unit, start.unit)):j.value);
    										}
    									}
    									end=__.getValueAndPrepareForAnimation(__.getStyle(elms[i], setting));
    									toAnimate.push({ 
    										target:elms[i],
    										properties:["style", setting],
    										start:start.value,
    										end:((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, end.value, end.unit, start.unit)):end.value),
    										bezier:bezier,
    										unit:start.unit,
    										prefix:start.prefix,
    										suffix:start.suffix,
    										separator:start.separator,
    										treatment:null
    									});
    								}
    							}
    						}
    					}
    				} else {
    					if (typeof(values[prop])=="object") {
    						p=values;
    						properties=__.getPropertiesContainingValues(p, null);
    						var tmpStart=[],
    							elmP=[];
    						for (i=0; i<elms.length; i++) {
    							elmP.push(elms[i]);
    						}
    						for (i=0; i<properties.length; i++) {
    							p=values;
    							for (j=0; j<properties[i].length; j++) {
    								p=p[properties[i][j]];
    								if (j==properties[i].length-2 && p.hasOwnProperty("treatment") && p.hasOwnProperty("value")) {
    									break;
    								}
    							}
    							tmpStart[i]={};
    							if (typeof(p)=="string" || typeof(p)=="number" ) {
    								start=__.getValueAndPrepareForAnimation(p);
    								tmpStart[i].start=start;
    								tmpStart[i].treatment=null;
    								tmpStart[i].props=properties[i];
    							} else if (typeof(p)=="object" && p.hasOwnProperty("treatment") && p.hasOwnProperty("value")) {
    								start=__.getValueAndPrepareForAnimation(p.value);
    								tmpStart[i].start=start;
    								tmpStart[i].treatment=p.treatment;
    								properties[i].splice(properties[i].length-1, 1);
    								tmpStart[i].props=properties[i];
    							}
    							i++;
    						}
    						var pMem;
    						for (q=0; q<tmpStart.length; q++) {
    							for (k=0; k<elmP.length; k++) {
    								p=elmP[k];
    								for (j=0; j<tmpStart[q].props.length; j++) {
    									if (j<tmpStart[q].props.length-1) {
    										pMem=p;
    									}
    									p=p[tmpEnd[q].props[j]];
    									if (j==tmpEnd[q].props.length-1) {
    										var lastProp=tmpEnd[q].props[j];
    										end=__.getValueAndPrepareForAnimation(p);
    										if (typeof(end.value)!="number") {
    											end.value=0;
    										}
    										toAnimate.push({ 
    											target:elmP[k],
    											properties:tmpEnd[q].props,
    											start:[tmpStart[q].start.value],
    											end:[(tmpStart[q].start.unit!=end.unit)?__.getValue(__.convertUnits(pMem, lastProp, end.value, end.unit, tmpStart[q].start.unit)):end.value],
    											unit:[tmpStart[q].start.unit],
    											prefix:[tmpStart[q].start.prefix],
    											suffix:[tmpStart[q].start.suffix],
    											separator:[tmpStart[q].start.separator],
    											treatment:[tmpStart[q].start.treatment]
    										});
    									}
    								}
    							}
    						}
    					} else {
    						start=__.getValueAndPrepareForAnimation(values[prop]);
    						for (i=0; i<elms.length; i++) {
    							if (typeof(elms[i][prop])=="undefined") {
    								elms[i][prop]=0;
    							}
    							end=__.getValueAndPrepareForAnimation(elms[i][prop]);
    							toAnimate.push({
    								target:elms[i],
    								properties:[prop],
    								start:[start.value],
    								end:[(start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], "", end.value, end.unit, start.unit)):end.value],
    								unit:[start.unit],
    								prefix:[start.prefix],
    								suffix:[start.suffix],
    								separator:[start.separator],
    								treatment:[start.treatment]
    							});
    						}
    					}
    				}
    			}
    			var uuid=__.guid();
    			__.tQ.push([toAnimate, parameters, uuid]);
    			if (!__.rAFinitiated) {
    				__.rAFinitiated=true;
    				__.animLoop();
    			}
    			setTimeout(function () { __.timerComplete(uuid); }, parameters.duration);
    		},
    		to:function(values, parameters, elms) {
    			var properties=__.getPropertiesContainingValues(values, null);
    			var i, j, k, l, p, q, r, s, t, u, props;
    			for (i=0; i<__.tQ.length; i++) {
    				for (j=0; j<__.tQ[i][0].length; j++) {
    					for (p in properties) {
    						props=__.implode(',', properties[p]);
    						if (elms.indexOf(__.tQ[i][0][j].target)!=-1 && props==__.implode(',', __.tQ[i][0][j].properties)) {
    							__.tQ[i][0].splice(j--, 1);
    							break;
    						}
    					}
    				}
    				if (__.tQ[i][0].length===0) {
    					__.tQ.splice(i--, 1);
    				}
    			}
    			parameters.duration=(parameters.hasOwnProperty("duration"))?parameters.duration:500;
    			parameters.easing=(parameters.hasOwnProperty("easing"))?parameters.easing:false;
    			parameters.oncomplete=(parameters.hasOwnProperty("oncomplete"))?parameters.oncomplete:false;
    			parameters.oncompleteparams=(parameters.hasOwnProperty("oncompleteparams"))?parameters.oncompleteparams:null;
    			parameters.startTime=new Date().getTime();
    			var toAnimate=[];
    			var start, end, startPrefixes, endPrefixes, currentPrefix, currentSuffix, notModified;
    			for (var prop in values) {
    				if (prop=="style") {
    					for (var setting in values.style) {
    						if (typeof(values.style[setting])!="object") {
    							r=typeof(values.style[setting])=="string"?values.style[setting].split(" "):[values.style[setting].toString()];
    							setting=__.verifySettingVariants(setting);
    							i=0;
    							while (i<r.length) {
    								if (r[i].indexOf("(")!=-1 && r[i].indexOf(")")==-1) {
    									r[i]+=r[i+1];
    									r.splice(i+1,1);
    								} else {
    									i++;
    								}
    							}
    							t=[];
    							s=[];
    							for (j=0; j<elms.length; j++) {
    								if (!t.hasOwnProperty(j)) {
    									t[j]={ start:[], end:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    								}
    								cs=__.getStyle(elms[j], setting);
    								s=cs.split(" ");
    								k=0;
    								while (k<s.length) {
    									if (s[k].indexOf("(")!=-1 && s[k].indexOf(")")==-1) {
    										s[k]+=s[k+1];
    										s.splice(k+1,1);
    									} else {
    										k++;
    									}
    								}
    							}
    							if (s.length>0) {
    								if (r.length==s.length) {
    									currentSuffix="";
    									for (i=0; i<r.length; i++) {
    										end=__.getValueAndPrepareForAnimation(r[i]);
    										for (j=0; j<elms.length; j++) {
    											currentPrefix="";
    											start=__.getValueAndPrepareForAnimation(s[i]);
    											if (end.prefix==start.prefix) {
    												if (start.animatable && end.animatable) {
    													t[j].start.push((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, start.value, start.unit, end.unit)):start.value);
    													t[j].end.push(end.value);
    													t[j].unit.push(end.unit);
    													t[j].prefix.push(currentPrefix==""?end.prefix:currentPrefix+" "+end.prefix);
    													t[j].suffix.push(end.suffix);
    													t[j].separator.push(end.separator);
    													t[j].treatment.push(end.treatment);
    													currentPrefix="";
    												} else if (!start.animatable && end.animatable) {
    													if (__.isArray(end.value)) {
    														t[j].start.push([]);
    														for (l=0; l<end.value.length; l++) {
    															t[j].start[t[j].start.length-1].push({ value:0, unit:end.value[l].unit, prefix:end.value[l].prefix, suffix:end.value[l].suffix, separator:end.value[l].separator, treatment:end.value[l].treatment });
    														}
    													} else {
    														t[j].start.push(0);
    													}
    													t[j].end.push(end.value);
    													t[j].unit.push(end.unit);
    													t[j].prefix.push(currentPrefix==""?end.prefix:currentPrefix+" "+end.prefix);
    													t[j].suffix.push(end.suffix);
    													t[j].separator.push(end.separator);
    													t[j].treatment.push(end.treatment);
    													currentPrefix="";
    												} else if (start.animatable && !end.animatable) {
    													t[j].start.push(start.value);
    													if (__.isArray(start.value)) {
    														t[j].end.push([]);
    														for (l=0; l<start.value.length; l++) {
    															t[j].end[t[j].end.length-1].push({ value:0, unit:start.value[l].unit, prefix:start.value[l].prefix, suffix:start.value[l].suffix, separator:start.value[l].separator, treatment:start.value[l].treatment });
    														}
    													} else {
    														t[j].end.push(0);
    													}
    													t[j].unit.push(start.unit);
    													t[j].prefix.push(currentPrefix==""?end.prefix:currentPrefix+" "+end.prefix);
    													t[j].suffix.push(end.suffix);
    													t[j].separator.push(end.separator);
    													t[j].treatment.push(end.treatment);
    													currentPrefix="";
    												} else {
    													if (t[j].suffix.length>0) {
    														t[j].suffix[t[j].suffix.length-1]+=end.value;
    													} else {
    														currentPrefix=end.value;
    													}
    												}
    											} else {
    												currentSuffix+=(start.animatable?" "+s[i]:"");
    												if (__.isArray(end.value)) {
    													t[j].start.push([]);
    													for (l=0; l<end.value.length; l++) {
    														t[j].start[t[j].start.length-1].push({ value:0, unit:end.value[l].unit, prefix:end.value[l].prefix, suffix:end.value[l].suffix, separator:end.value[l].separator, treatment:end.value[l].treatment });
    													}
    												} else {
    													t[j].start.push(0);
    												}
    												t[j].end.push(end.value);
    												t[j].unit.push(end.unit);
    												t[j].prefix.push(end.prefix);
    												t[j].suffix.push(end.suffix+(i==r.length-1?currentSuffix:""));
    												t[j].separator.push(end.separator);
    												t[j].treatment.push(end.treatment);
    											}
    										}
    									}
    									for (j=0; j<elms.length; j++) {
    										toAnimate.push({ 
    											target:elms[j],
    											properties:["style", setting],
    											start:t[j].start,
    											end:t[j].end,
    											unit:t[j].unit,
    											prefix:t[j].prefix,
    											suffix:t[j].suffix,
    											separator:t[j].separator,
    											treatment:t[j].treatment
    										});
    									}
    								} else if (/[transform|filter]/i.test(setting)) {
    									endPrefixes=[];
    									end=[];
    									for (i=0; i<r.length; i++) {
    										end.push(__.getValueAndPrepareForAnimation(r[i]));
    										endPrefixes.push(end[end.length-1].prefix);
    									}
    									startPrefixes=[];
    									start=[];
    									notModified=[];
    									for (j=0; j<elms.length; j++) {
    										start[j]=[];
    										startPrefixes[j]=[];
    										notModified[j]=[];
    										if (!t.hasOwnProperty(j)) {
    											t[j]={ start:[], end:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    										}
    										for (k=0; k<s.length; k++) {
    											u=__.getValueAndPrepareForAnimation(s[k]);
    											if (endPrefixes.indexOf(u.prefix)==-1) {
    												notModified[j].push(s[k]);
    											} else {
    												start[j][endPrefixes.indexOf(u.prefix)]=u;
    												startPrefixes[j][endPrefixes.indexOf(u.prefix)]=u.prefix;
    											}
    										}
    									}
    									for (j=0; j<elms.length; j++) {
    										for (i=0; i<endPrefixes.length; i++) {
    											if (startPrefixes[j].indexOf(endPrefixes[i])==-1) {
    												k={ value:[], unit:[], prefix:[], suffix:[], separator:[], treatment:[] };
    												if (end[i].type="object") {
    													for (p=0; p<end[i].value.length; p++) {
    														k.value[p]={ value:0, unit:end[i].value[p].unit, prefix:end[i].value[p].prefix, suffix:end[i].value[p].suffix, separator:end[i].value[p].separator, treatment:end[i].value[p].treatment };
    													}
    													k.unit=end[i].unit;
    													k.prefix=end[i].prefix;
    													k.suffix=end[i].suffix;
    													k.separator=end[i].separator;
    													k.treatment=end[i].treatment;
    													start[j][i]=k;
    												}
    												startPrefixes[j][i]=endPrefixes[i];
    											}
    										}
    										if (start[j].length==end.length) {
    											currentPrefix="";
    											for (i=0; i<notModified[j].length; i++) {
    												if (notModified[j][i]!="none" && notModified[j][i]!="auto") {
    													currentPrefix+=notModified[j][i]+" ";
    												}
    											}
    											for (i=0; i<end.length; i++) {
    												t[j].start.push(start[j][i].value);
    												t[j].end.push(end[i].value);
    												t[j].unit.push(start[j][i].unit);
    												t[j].prefix.push(currentPrefix==""?end[i].prefix:currentPrefix+end[i].prefix);
    												t[j].suffix.push(end[i].suffix);
    												t[j].separator.push(end[i].separator);
    												t[j].treatment.push(end[i].treatment);
    												currentPrefix="";
    											}
    											toAnimate.push({ 
    												target:elms[j],
    												properties:["style", setting],
    												start:t[j].start,
    												end:t[j].end,
    												unit:t[j].unit,
    												prefix:t[j].prefix,
    												suffix:t[j].suffix,
    												separator:t[j].separator,
    												treatment:t[j].treatment
    											});
    										}
    									}
    								} else {
    									console.log("You are trying to animate between incompatible values for "+setting);
    								}
    							} else {
    								console.log("lib.to: no Element was selected");
    							}
    						} else {
    							if (values.style[setting].hasOwnProperty("value") && values.style[setting].hasOwnProperty("treatment")) {
    								end=__.getValueAndPrepareForAnimation(values.style[setting].value);
    								for (i=0; i<elms.length; i++) {
    									start=__.getValueAndPrepareForAnimation(__.getStyle(elms[i], setting));
    									toAnimate.push({ 
    										target:elms[i], 
    										properties:["style", setting], 
    										start:[((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, start.value, start.unit, end.unit)):start.value)], 
    										end:[end.value], 
    										unit:[end.unit], 
    										prefix:[end.prefix],
    										suffix:[end.suffix], 
    										separator:[end.separator], 
    										treatment:[values.style[setting].treatment]
    									});
    								}
    							} else if (values.style[setting].hasOwnProperty("end") && values.style[setting].hasOwnProperty("b1")) {
    								for (i=0; i<elms.length; i++) {
    									var bezier=[];
    									end=__.getValueAndPrepareForAnimation(values.style[setting].end);
    									for (p in values.style[setting]) {
    										if (p!="end") {
    											j=__.getValueAndPrepareForAnimation(values.style[setting][p]);
    											bezier.push((j.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, j.value, j.unit, end.unit)):j.value);
    										}
    									}
    									start=__.getValueAndPrepareForAnimation(__.getStyle(elms[i], setting));
    									toAnimate.push({ 
    										target:elms[i],
    										properties:["style", setting],
    										start:((start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], setting, start.value, start.unit, end.unit)):start.value),
    										end:end.value,
    										bezier:bezier,
    										unit:end.unit,
    										prefix:end.prefix,
    										suffix:end.suffix,
    										separator:end.separator,
    										treatment:null
    									});
    								}
    							}
    						}
    					}
    				} else {
    					if (typeof(values[prop])=="object") {
    						p=values;
    						properties=__.getPropertiesContainingValues(p, null);
    						var tmpEnd=[],
    							elmP=[];
    						for (i=0; i<elms.length; i++) {
    							elmP.push(elms[i]);
    						}
    						for (i=0; i<properties.length; i++) {
    							p=values;
    							for (j=0; j<properties[i].length; j++) {
    								p=p[properties[i][j]];
    								if (j==properties[i].length-2 && p.hasOwnProperty("treatment") && p.hasOwnProperty("value")) {
    									break;
    								}
    							}
    							tmpEnd[i]={};
    							if (typeof(p)=="string" || typeof(p)=="number" ) {
    								end=__.getValueAndPrepareForAnimation(p);
    								tmpEnd[i].end=end;
    								tmpEnd[i].treatment=null;
    								tmpEnd[i].props=properties[i];
    							} else if (typeof(p)=="object" && p.hasOwnProperty("treatment") && p.hasOwnProperty("value")) {
    								end=__.getValueAndPrepareForAnimation(p.value);
    								tmpEnd[i].end=end;
    								tmpEnd[i].treatment=p.treatment;
    								properties[i].splice(properties[i].length-1, 1);
    								tmpEnd[i].props=properties[i];
    							}
    							i++;
    						}
    						var pMem;
    						for (q=0; q<tmpEnd.length; q++) {
    							for (k=0; k<elmP.length; k++) {
    								p=elmP[k];
    								for (j=0; j<tmpEnd[q].props.length; j++) {
    									if (j<tmpEnd[q].props.length-1) {
    										pMem=p;
    									}
    									p=p[tmpEnd[q].props[j]];
    									if (j==tmpEnd[q].props.length-1) {
    										var lastProp=tmpEnd[q].props[j];
    										start=__.getValueAndPrepareForAnimation(p);
    										if (typeof(start.value)!="number") {
    											start.value=0;
    										}
    										toAnimate.push({ 
    											target:elmP[k],
    											properties:tmpEnd[q].props,
    											start:[(start.unit!=tmpEnd[q].end.unit)?__.getValue(__.convertUnits(pMem, lastProp, start.value, start.unit, tmpEnd[q].end.unit)):start.value],
    											end:[tmpEnd[q].end.value],
    											unit:[tmpEnd[q].end.unit],
    											prefix:[tmpEnd[q].end.prefix],
    											suffix:[tmpEnd[q].end.suffix],
    											separator:[tmpEnd[q].end.separator],
    											treatment:[tmpEnd[q].end.treatment]
    										});
    									}
    								}
    							}
    						}
    					} else {
    						end=__.getValueAndPrepareForAnimation(values[prop]);
    						for (i=0; i<elms.length; i++) {
    							if (typeof(elms[i][prop])=="undefined") {
    								elms[i][prop]=0;
    							}
    							start=__.getValueAndPrepareForAnimation(elms[i][prop]);
    							toAnimate.push({
    								target:elms[i],
    								properties:[prop],
    								start:[(start.unit!=end.unit)?__.getValue(__.convertUnits(elms[i], "", start.value, start.unit, end.unit)):start.value],
    								end:[end.value],
    								unit:[end.unit],
    								prefix:[end.prefix],
    								suffix:[end.suffix],
    								separator:[end.separator],
    								treatment:[end.treatment]
    							});
    						}
    					}
    				}
    			}
    			var uuid=__.guid();
    			__.tQ.push([toAnimate, parameters, uuid]);
    			if (!__.rAFinitiated) {
    				__.rAFinitiated=true;
    				__.animLoop();
    			}
    			setTimeout(function () { __.timerComplete(uuid); }, parameters.duration);
    		},
    D'autre part sous chrome, la gestion des polices avec taille à virgule (comme par exemple générée via em pour un responsive design) semble poser problème au niveau du masque de couleur:
    regarde le site suivant (que j'ai réalisé) sous chrome:
    http://www.michelocelot.fr/
    dans certaines tailles de fenêtre, la modification de la couleur de police pose problème, le masque de couleur semble être en valeur "plancher" alors que la police semble être en arrondi,
    ce qui cause une ligne blanche persistante avec le mouseover.
    Sur d'autres navigateurs, cela ne se produit pas.

    edit voici le record heap allocations sur une bonne minute, si je ne me trompe pas et que les tailles sont en octets, cela ne vient alors pas du moteur js
    Nom : Capture d’écran 2014-09-18 à 14.07.30.png
Affichages : 103
Taille : 67,1 Ko
    0x4F

  4. #4
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Watilin, tout d'abord, un grand merci publiquement pour ton aide,
    avoir passé du temps à décortiquer mon code pour m'aider à l'améliorer en me laissant un mp, super!
    hey, si tu as une wishlist avec des bouquins (pas trop chers please je suis sans le sou) que tu veux, je t'en paie un!
    je viens de faire un bench sur trois librairies du marché. il est disponible ici:
    http://lib-js.com/bench.html
    à gauche lib.js,
    au centre jquery,
    à droite, la librairie gsap;
    apparemment la lib home made se débrouille bien, gère les transform css3 sans erreur, ce qui n'est pas le cas nativement pour jquery 2.1.1 et gsap 1 les gère mais en faisant une erreur semble-t-il sur le fin de la rotation 2d, la transformant en rotation 3d.

    Je n'ai pas encore tout corrigé, l'aberration avec 2 r sur les fonctions easing elastic qui renvoie NaN va être corrigée sur tes conseils.
    Si le bench vous satisfait, laissez des impressions svp!

    à noter que le double usage request animation frame pour l'animation et setTimeout pour la fin de l'animation permet de maintenir une activité, certes limitée, quand l'onglet est masqué par un autre mais de toute importance dans le cas d'une horloge animée par exemple, ce qui n'est pas le cas de gsap. et Jquery lui est basé sur setinterval, ce qui est moins puissant pour les animations.

    à plus
    0x4F

  5. #5
    Expert éminent
    Avatar de Watilin
    Homme Profil pro
    En recherche d'emploi
    Inscrit en
    Juin 2010
    Messages
    3 093
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 35
    Localisation : France, Ille et Vilaine (Bretagne)

    Informations professionnelles :
    Activité : En recherche d'emploi

    Informations forums :
    Inscription : Juin 2010
    Messages : 3 093
    Points : 6 754
    Points
    6 754
    Par défaut
    Ça me rappelle un papier que j'ai lu : (en) CSS vs. JS animation. Ça explique notamment pourquoi jQuery n'utilise pas requestAnimationFrame – c'est un choix délibéré.

    Je n'ai pas réussi à reproduire ton problème de masque de couleur sur le site de Michel Ocelot. Est-ce que ça concerne aussi uniquement Chrome/Mac ?

    Le bench est intéressant. Je ne comprends pas ce qui se passe avec GSAP, mais en même temps je ne connais pas cette lib…
    La FAQ JavaScript – Les cours JavaScript
    Touche F12 = la console → l’outil indispensable pour développer en JavaScript !

  6. #6
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Oui, Watilin, ça semble uniquement concerner Chrome Mac, d'ailleurs le problème de débordement de mémoire est plus lent sous chrome pc pour l'animation de fonts.

    Je ne connais pas bien GSAP non plus, mais il semble qu'elle convertisse d'emblée toute rotation 2d en 3d et qu'elle commette des erreurs dans certains cas de figure.
    0x4F

  7. #7
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 73
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Points : 22 933
    Points
    22 933
    Billets dans le blog
    125
    Par défaut
    [...] à gauche lib.js,
    au centre jquery,
    à droite, la librairie gsap;
    apparemment la lib home made se débrouille bien, gère les transform css3 sans erreur, ce qui n'est pas le cas nativement pour jquery 2.1.1 et gsap 1 les gère mais en faisant une erreur semble-t-il sur le fin de la rotation 2d, la transformant en rotation 3d. [...]
    Il y a une signature de la méthode animate() qui permet l'utilisation de "transform" (impossible de donner la référence, le site est inaccessible pour l'instant). Voici le code de ma page de test.

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    <!DOCTYPE html>
    <html lang="fr" dir="ltr">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0">
        <meta name="author" content="Daniel Hagnoul">
        <title>Forum jQuery</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.min.js"></script>
        <link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Sofia|Ubuntu:400|Kreon'>
        <script>
            "use strict";
     
            var debugBool = true;
     
             /*
              * J'utilise head.js pour charger CSS et JS de manière asynchrone 
              * et parallèle, mais les fichiers sont exécute dans l'ordre.
              * Voir la documentation et l'API : http://headjs.com/
              * Les polices de caractères et le fichier head.js doivent être 
              * inclus manuellement.
              */
            head.load(
                "http://danielhagnoul.developpez.com/styles/dvjhRemBase.css",
                "http://code.jquery.com/ui/1.11.0/themes/sunny/jquery-ui.css",
                "http://code.jquery.com/qunit/qunit-1.15.0.css",
                { "d3" : "http://d3js.org/d3.v3.min.js" },
                { "d3Hello" : "http://danielhagnoul.developpez.com/lib/dvjh/d3Hello.js" },
                { "jquery" : "http://code.jquery.com/jquery-2.1.1.min.js" },
                { "jqueryui" : "http://code.jquery.com/ui/1.11.0/jquery-ui.min.js" },
                { "datefr" : "http://danielhagnoul.developpez.com/lib/dvjh/datefr.js" },
                { "qunit" : "http://code.jquery.com/qunit/qunit-1.15.0.js" },
                { "testsQUnit" : "http://danielhagnoul.developpez.com/lib/dvjh/testsQUnit.js" }
            );      
        </script>
        <style>
            /* Nota bene : ici 1 rem est égal à 10 px, voir dvjhRemBase.css */
     
    /*-- Début code du test --*/
     
    #_2 { position: relative; margin: 2em; width: 10em; height: 10em; left: 0; top: 0; font-size: 40px; }
    #_2a { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 0em; background-color: #000; }
    #_2b { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 9em; background-color: #030; }
    #_2c { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 9em; background-color: #060; }
    #_2d { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 0em; background-color: #090; }
    #console { position: relative; width: 3em; height: 1em; top: 2em; left: 1em; font-size: 2em; text-align: center; }
     
    /*-- Fin code du test --*/
     
        </style>
    </head>
    <body>
        <header>
            <h1>Forum jQuery</h1>
            <h2>
                <a href="">Lien</a>
            </h2>
        </header>
        <section class="conteneur">
            <nav>
     
    <!-- Début code du test -->
     
     
     
    <!-- Fin code du test -->
     
            </nav>
            <article>
     
    <!-- Début code du test -->
     
    <div id="_2">
        <div id="_2a"></div>  
        <div id="_2b"></div>
        <div id="_2c"></div>
        <div id="_2d"></div>  
        <div id="console">0</div>        
    </div>
     
     
    <!-- Fin code du test -->
     
            </article>
            <article class="qunit">
                <div id="qunit"></div>
                <div id="qunit-fixture"></div>
            </article>
        </section>
        <footer class="h-entry">
            <time class="dt-published" datetime="2014-01-22T10:36:43.443+0100">2014-01-22T10:36:43.443+0100</time>
            <a class="p-author h-card" href="http://www.developpez.net/forums/u285162/danielhagnoul/">Daniel Hagnoul</a>
            <a class="u-url" href="http://danielhagnoul.developpez.com/">Mon cahier d’exercices</a>
            <a class="u-url" href="http://javascript.developpez.com/faq/jquery/">FAQ</a>
            <a class="u-url" href="http://javascript.developpez.com/cours/?page=frameworks#jquery">Tutoriels</a>
        </footer>
        <script>
            "use strict";
            /*
             * Chargeur de code head.js, document ready et fichiers chargés.
             */
            head.ready( [ 
                    "d3", "d3Hello", 
                    "jquery", "jqueryui", "datefr",
                    "qunit", "testsQUnit"
                ], function(){
     
    /* Début code du test */
     
    $( function(){ // forme abrégée de $(document).ready(function(){
     
        var time = 1000,
            count = -1,
            jObjConsole = $( "#console" ),
            jObj2a = $( '#_2a' ),
            jObj2b = $( '#_2b' ),
            jObj2c = $( '#_2c' ),
            jObj2d = $( '#_2d' ),
            throwJQ = function(){
                count++;
                jObjConsole.text( count );
     
                var count4 = count % 4,
                    count490 = count4 * 90,
                    count414 = ( count4 + 1 ) / 4;
     
                switch( count4 ){
                    case 0:
                        jObj2a
                            .animate(
                                { 
                                    "left" : "9em", 
                                    "top" : "0em", 
                                    "deg" : count490 
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                             );
     
                        jObj2b
                            .animate(
                                { 
                                    "left": "9em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2c
                            .animate(
                                { 
                                    "left": "0em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2d
                            .animate(
                                {
                                    "left": "0em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                        throwJQ();
                                    }
                                }
                            );
                    break;
                    case 1:
                         jObj2a
                            .animate(
                                {
                                    "left" : "9em", 
                                    "top" : "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                             );
     
                        jObj2b
                            .animate(
                                { 
                                    "left": "0em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                     "easing" : "easeInOutQuad",
                                   "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2c
                            .animate(
                                { 
                                    "left": "0em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2d
                            .animate(
                                {
                                    "left": "9em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                        throwJQ();
                                    }
                                }
                            );
                    break;
                    case 2:
                        jObj2a
                            .animate(
                                {
                                    "left" : "0em", 
                                    "top" : "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                             );
     
                        jObj2b
                            .animate(
                                { 
                                    "left": "0em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2c
                            .animate(
                                { 
                                    "left": "9em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2d
                            .animate(
                                {
                                    "left": "9em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                        throwJQ();
                                    }
                                }
                            );
                    break;
                    case 3:
                        jObj2a
                            .animate(
                                {
                                    "left" : "0em", 
                                    "top" : "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                             );
     
                        jObj2b
                            .animate(
                                { 
                                    "left": "9em", 
                                    "top": "0em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2c
                            .animate(
                                { 
                                    "left": "9em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                    }
                                }
                            );
     
                        jObj2d
                            .animate(
                                {
                                    "left": "0em", 
                                    "top": "9em", 
                                    "deg" : count490
                                }, 
                                {
                                    "duration" : time,
                                    "easing" : "easeInOutQuad",
                                    "step" : function( now ){
                                        $( this ).css( "transform", "rotate(" + now + "deg) scale(" + count414 + "," + count414 + ")" );
                                    },
                                    "complete" : function(){
                                        throwJQ();
                                    }
                                }
                            );
                    break;
                }
            };
     
        throwJQ();
     
    });
     
    /* Fin code du test */
     
                if ( debugBool ){
                   console.log( ISOformat( new Date() ) );
     
                    $( ".qunit" ).show();
     
                    testQUnitSelector( "App", [ 
                        "#qunit", "#qunit-fixture", ".conteneur"
                    ] );
     
                    testQUnitID( "App", [ 
                        "qunit", "qunit-fixture"
                    ] );
                }
     
            });
        </script>
    </body>
    </html>

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  8. #8
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    merci Daniel, j'ai mis ton test avec le mien sur http://lib-js.com/bench.html

    Cependant, même avec ça jquery ne semble pas gérer tous les paramètres à animer: ici le scale n'est plus géré de façon animée.
    0x4F

  9. #9
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 73
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Points : 22 933
    Points
    22 933
    Billets dans le blog
    125
    Par défaut
    Je me suis trompé, la bonne manière d'utiliser la méthode set() et son paramètre "now", c'est :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    jObj2c
        .animate(
            { 
                "left": "0em", 
                "top": "9em"
            }, 
            {
                "duration" : time,
                "easing" : "easeInOutQuad",
                "step" : function( now, fx ){
                    var d = count490 * now,
                        s = count414; // Où le résultat d'un calcul incluant now ?
     
                    $( this ).css( "transform", "rotate(" + d + "deg) scale(" + s + "," + s + ")" );
                },
                "complete" : function(){
                }
            }
        );
    Mais je n'ai pas trouvé la bonne méthode pour calculer "scale".

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  10. #10
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    j'ai corrigé ton code:
    il faut faire ainsi avec jquery, ça fonctionne, ceci dit le code est lourd:
    Code javascript : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
     
    "use strict";
            head.ready( [ 
                    "d3",
                    "jquery", "jqueryui", "datefr",
                    "qunit", "testsQUnit"
                ], function(){
    var pos = [
        [9,0],
        [9,9],
        [0,9],
        [0,0]
    ];
    $( function(){ // forme abrégée de $(document).ready(function(){
     
        var time = 1000,
            count = -1,
            jObjConsole = $( "#console" ),
            jObj=[
                $( '#_2a' ),
                $( '#_2b' ),
                $( '#_2c' ),
                $( '#_2d' )
            ],
            throwJQ = function(){
                count++;
                jObjConsole.text( count );
                var count4 = count % 4,
                    count490 = count4 * 90,
                    count414 = ( count4 + 1 ) / 4;
                var oldcount4 = ((count-1) % 4>=0?(count-1) % 4:3),
                    oldcount490 = oldcount4 * 90,
                    oldcount414 = ( oldcount4 + 1 ) / 4;
                for (var i=0; i<jObj.length; i++) {
                    $( jObj[i] ).css( "time", 0 );
                    jObj[i].animate(
                        { 
                            "left" : pos[(count+i)%4][0]+"em", 
                            "top" : pos[(count+i)%4][1]+"em",
                            "time" : 1000 
                        }, 
                        {
                            "duration" : time,
                            "easing" : "easeInOutQuad",
                            "step" : function( now, fx ){
                                if (fx.prop=="time") {
                                    var d = oldcount490+(count490-oldcount490)*now/1000;
                                    var s = oldcount414+(count414-oldcount414)*now/1000;
                                    $( this ).css( "transform", "rotate(" + d + "deg) scale(" + s + "," + s + ")" );
                                }
                            },
                            "complete" : (i==jObj.length-1)?function() {
                                throwJQ();
                            }
                            : function() {
                            }
                        }
                     );
                }
            };
        throwJQ();
    });
    résultat sur http://lib-js.com/bench.html
    0x4F

  11. #11
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 73
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Points : 22 933
    Points
    22 933
    Billets dans le blog
    125
    Par défaut
    Ce n'était pas évident pour moi, je n'y arrivais pas.

    Je viens de tester pour différentes valeurs et en effet la durée de l'animation ("duration") et la valeur de "time" doivent être identique, de plus il faut absolument diviser "now" par " time". J'ai appris quelque chose aujourd'hui, merci !

    Je vais garder ce code comme exemple :

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    <!DOCTYPE html>
    <html lang="fr" dir="ltr">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0">
        <meta name="author" content="Daniel Hagnoul">
        <title>Forum jQuery</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.min.js"></script>
        <link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Sofia|Ubuntu:400|Kreon'>
        <script>
            "use strict";
     
            var debugBool = true;
     
             /*
              * J'utilise head.js pour charger CSS et JS de manière asynchrone 
              * et parallèle, mais les fichiers sont exécute dans l'ordre.
              * Voir la documentation et l'API : http://headjs.com/
              * Les polices de caractères et le fichier head.js doivent être 
              * inclus manuellement.
              */
            head.load(
                "http://danielhagnoul.developpez.com/styles/dvjhRemBase.css",
                "http://code.jquery.com/ui/1.11.0/themes/sunny/jquery-ui.css",
                "http://code.jquery.com/qunit/qunit-1.15.0.css",
                { "d3" : "http://d3js.org/d3.v3.min.js" },
                { "d3Hello" : "http://danielhagnoul.developpez.com/lib/dvjh/d3Hello.js" },
                { "jquery" : "http://code.jquery.com/jquery-2.1.1.min.js" },
                { "jqueryui" : "http://code.jquery.com/ui/1.11.0/jquery-ui.min.js" },
                { "datefr" : "http://danielhagnoul.developpez.com/lib/dvjh/datefr.js" },
                { "qunit" : "http://code.jquery.com/qunit/qunit-1.15.0.js" },
                { "testsQUnit" : "http://danielhagnoul.developpez.com/lib/dvjh/testsQUnit.js" }
            );      
        </script>
        <style>
            /* Nota bene : ici 1 rem est égal à 10 px, voir dvjhRemBase.css */
     
    /*-- Début code du test --*/
     
    #_2 { position: relative; margin: 2em; width: 10em; height: 10em; left: 0; top: 0; font-size: 40px; border: 1px dotted grey; }
    #_2a { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 0em; background-color: #000; }
    #_2b { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 9em; background-color: #030; }
    #_2c { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 9em; background-color: #060; }
    #_2d { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 0em; background-color: #090; }
    #console { position: relative; width: 3em; height: 1em; top: 2em; left: 1em; font-size: 2em; text-align: center; }
     
    /*-- Fin code du test --*/
     
        </style>
    </head>
    <body>
        <header>
            <h1>Forum jQuery</h1>
            <h2>
                <a href="">Lien</a>
            </h2>
        </header>
        <section class="conteneur">
            <nav>
     
    <!-- Début code du test -->
     
     
     
    <!-- Fin code du test -->
     
            </nav>
            <article>
     
    <!-- Début code du test -->
     
    <div id="_2">
        <div id="_2a"></div>  
        <div id="_2b"></div>
        <div id="_2c"></div>
        <div id="_2d"></div>  
        <div id="console">0</div>        
    </div>
     
     
    <!-- Fin code du test -->
     
            </article>
            <article class="qunit">
                <div id="qunit"></div>
                <div id="qunit-fixture"></div>
            </article>
        </section>
        <footer class="h-entry">
            <time class="dt-published" datetime="2014-01-22T10:36:43.443+0100">2014-01-22T10:36:43.443+0100</time>
            <a class="p-author h-card" href="http://www.developpez.net/forums/u285162/danielhagnoul/">Daniel Hagnoul</a>
            <a class="u-url" href="http://danielhagnoul.developpez.com/">Mon cahier d’exercices</a>
            <a class="u-url" href="http://javascript.developpez.com/faq/jquery/">FAQ</a>
            <a class="u-url" href="http://javascript.developpez.com/cours/?page=frameworks#jquery">Tutoriels</a>
        </footer>
        <script>
            "use strict";
            /*
             * Chargeur de code head.js, document ready et fichiers chargés.
             */
            head.ready( [ 
                    "d3", "d3Hello", 
                    "jquery", "jqueryui", "datefr",
                    "qunit", "testsQUnit"
                ], function(){
     
    /* Début code du test */
     
    $( function(){ // forme abrégée de $(document).ready(function(){
     
        var pos = [
                [ 9, 0 ],
                [ 9, 9 ],
                [ 0, 9 ],
                [ 0, 0 ]
            ],
            jObjs=[
                $( '#_2a' ),
                $( '#_2b' ),
                $( '#_2c' ),
                $( '#_2d' )
            ],
            n = jObjs.length,
            time = 800,
            count = -1,
            jObjConsole = $( "#console" ),
            throwJQ = function(){
                count++;
                jObjConsole.text( count );
     
                var count4 = count % 4,
                    count490 = count4 * 90,
                    count414 = ( count4 + 1 ) / 4,
                    oldcount4 = ( ( count - 1 ) % 4 >= 0 ? ( count - 1 ) % 4 : 3 ),
                    oldcount490 = oldcount4 * 90,
                    oldcount414 = ( oldcount4 + 1 ) / 4;
     
                for ( var i = 0; i < n; i++ ){
                    jObjs[i].css( "time", 0 );
                    jObjs[i].animate(
                        { 
                            "left" : pos[ ( count + i ) % 4 ][ 0 ] + "em", 
                            "top" : pos[ ( count + i ) % 4 ][ 1 ] + "em",
                            "time" : time 
                        }, 
                        {
                            "duration" : time,
                            "easing" : "easeInOutQuad",
                            "step" : function( now, fx ){
                                if ( fx.prop == "time" ){
                                    var d = oldcount490 + ( count490 - oldcount490 ) * now / time,
                                        s = oldcount414 + ( count414 - oldcount414 ) * now / time;
     
                                    $( this ).css( "transform", "rotate(" + d + "deg) scale(" + s + "," + s + ")" );
                                }
                            },
                            "complete" : ( i == n - 1 ) ? function(){ throwJQ(); } : function(){}
                        }
                     );
                }
            };
     
        throwJQ();
     
    });
     
    /* Fin code du test */
     
                if ( debugBool ){
                   console.log( ISOformat( new Date() ) );
     
                    $( ".qunit" ).show();
     
                    testQUnitSelector( "App", [ 
                        "#qunit", "#qunit-fixture", ".conteneur"
                    ] );
     
                    testQUnitID( "App", [ 
                        "qunit", "qunit-fixture"
                    ] );
                }
     
            });
        </script>
    </body>
    </html>

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  12. #12
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Content de t'avoir aidé!
    Sinon la librairie que je fais est open source, tu pourras donc la "pomper" dès qu'elle sera finie, je vais faire un site avec un manuel clairement expliqué, j'espère que ça aidera des gens dans leur développement. Le plus puissant sera l'animation svg.
    0x4F

  13. #13
    Membre actif

    Profil pro
    Inscrit en
    Juillet 2012
    Messages
    183
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Juillet 2012
    Messages : 183
    Points : 274
    Points
    274
    Par défaut
    Tu n'as pas vraiment créé de lib, tu n'as fais que copier-coller des morceaux de code de la MDN (pour tous les Array.prototype), surtout que la moitié sont presques inutiles de nos jours.

    Tu as rajouté QuickSort, mais pourtant cette chose est inutile, les commentaires le disent eux-même :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
     
    /**
    		 * An implementation for Quicksort. Doesn't
    		 * perform as well as the native Array.sort
    		 * and also runs the risk of a stack overflow
     
    		 * Quicksort.sort(array);
    		 *
    		 * @author Paul Lewis
    		 * @modified Fabien Auréjac
    		*/
    Et le gros pavé de fonctions regroupées sous "__" je ne sais pas trop à quoi il sert mais 90% des fonctions ne sont pas utiles en général sur un projet.
    D'ailleurs certaines d'entre elles pourraient être optimisées :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
     
    escapeSimpleQuotes: function(str) {
                var i = 0;
                while (i < str.length) {
                    if (str.substr(i, 1) == "'") {
                        str = str.substr(0, i) + "\\" + str.substr(i, str.length - i);
                        i += 2;
                    } else {
                        i++;
                    }
                }
                return str;
            },
            escapeDoubleQuotes: function(str) {
                var i = 0;
                while (i < str.length) {
                    if (str.substr(i, 1) == '"') {
                        str = str.substr(0, i) + "\\" + str.substr(i, str.length - i);
                        i += 2;
                    } else {
                        i++;
                    }
                }
                return str;
            },
    La dernière fois que j'ai vu du remplacement de chaine de caractères écrit de cette manière c'était en 1999.
    On pourrait les remplacer par ça :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
     
    escapeSimpleQuotes : function(str)*{
       return str.replace(/'/g,"\\'");
    },
    escapeDoubleQuotes : function(str)*{
       return str.replace(/"/g,'\\"');
    }
    Bref, je n'irai jamais utiliser une telle librairie, surtout qu'elle pèse 100Ko une fois passé sous PackerJS, c'est encore énorme. Autant directement utiliser Bower + un outil de concat, ça fera la même chose et on pourra rajouter ce qu'on veut au besoin

  14. #14
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    Dis-donc tu es de super bonne humeur ce matin toi, ou tu es toujours comme ça?
    désolé de te décevoir mais très peu de parties sont copiées.
    Il y a juste cette fonction de quicksort et quelques fonctions de easing, car il ne sert à rien de réinventer la roue sans cesse.
    D'ailleurs pour les fonctions de easing, je suis en train d'en concevoir d'autres à l'aide d'un logiciel de graphe, pour progresser.

    Et les correctifs de la mdn, c'est pour les vieilles versions d'IE, ça représente, alleeeeeeeez, 2% de mon code?
    Bon bref, on part d'une bonne intention et on s'en prend plein la g*****.
    Mais t'inquiète j'ai l'habitude, il y a toujours un mec suffisamment hargneux pour venir pourrir les efforts de quelqu'un.
    Pour le reste merci pour l'info, les escapeDoubleQuotes et escapeSimpleQuotes, je vais les améliorer, très cher.

    Je sais que j'ai sûrement des progrès à faire, mais tu vois, j'en avais un peu marre de jquery qui change sans cesse de specifications, et qui ne gère pas le css3 nativement s'entend.
    Et ne t'inquiète pas je serai content qu'un type comme toi n'utilise pas mon travail. Pour le reste, je ne vais pas te raconter ma vie.
    0x4F

  15. #15
    Rédacteur

    Avatar de danielhagnoul
    Homme Profil pro
    Étudiant perpétuel
    Inscrit en
    Février 2009
    Messages
    6 389
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 73
    Localisation : Belgique

    Informations professionnelles :
    Activité : Étudiant perpétuel
    Secteur : Enseignement

    Informations forums :
    Inscription : Février 2009
    Messages : 6 389
    Points : 22 933
    Points
    22 933
    Billets dans le blog
    125
    Par défaut
    Pour jQuery, il y a plus simple !

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    <!DOCTYPE html>
    <html lang="fr" dir="ltr">
    <head>
        <meta charset="utf-8">
        <meta name="viewport" content="initial-scale=1.0">
        <meta name="author" content="Daniel Hagnoul">
        <title>Forum jQuery</title>
        <script src="http://cdnjs.cloudflare.com/ajax/libs/headjs/1.0.3/head.min.js"></script>
        <link rel="stylesheet" href='http://fonts.googleapis.com/css?family=Sofia|Ubuntu:400|Kreon'>
        <script>
            "use strict";
     
            var debugBool = true;
     
             /*
              * J'utilise head.js pour charger CSS et JS de manière asynchrone 
              * et parallèle, mais les fichiers sont exécute dans l'ordre.
              * Voir la documentation et l'API : http://headjs.com/
              * Les polices de caractères et le fichier head.js doivent être 
              * inclus manuellement.
              */
            head.load(
                "http://danielhagnoul.developpez.com/styles/dvjhRemBase.css",
                "http://code.jquery.com/ui/1.11.0/themes/sunny/jquery-ui.css",
                "http://code.jquery.com/qunit/qunit-1.15.0.css",
                { "d3" : "http://d3js.org/d3.v3.min.js" },
                { "d3Hello" : "http://danielhagnoul.developpez.com/lib/dvjh/d3Hello.js" },
                { "jquery" : "http://code.jquery.com/jquery-2.1.1.min.js" },
                { "jqueryui" : "http://code.jquery.com/ui/1.11.0/jquery-ui.min.js" },
                { "datefr" : "http://danielhagnoul.developpez.com/lib/dvjh/datefr.js" },
                { "qunit" : "http://code.jquery.com/qunit/qunit-1.15.0.js" },
                { "testsQUnit" : "http://danielhagnoul.developpez.com/lib/dvjh/testsQUnit.js" }
            );      
        </script>
        <style>
            /* Nota bene : ici 1 rem est égal à 10 px, voir dvjhRemBase.css */
     
    /*-- Début code du test --*/
     
    #btnToggle { margin: 12px; }
    #_2 { position: relative; margin: 12px; width: 10em; height: 10em; left: 0; top: 0; font-size: 40px; border: 1px dotted grey; }
    #_2a { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 0em; background-color: #000; }
    #_2b { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 0em; left: 9em; background-color: #030; }
    #_2c { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 9em; background-color: #060; }
    #_2d { position: absolute; width: 1em; height: 1em; border-radius: 0.25em; top: 9em; left: 0em; background-color: #090; }
    #console { position: relative; width: 3em; height: 1em; top: 2em; left: 1em; font-size: 2em; text-align: center; }
     
    /*-- Fin code du test --*/
     
        </style>
    </head>
    <body>
        <header>
            <h1>Forum jQuery</h1>
            <h2>
                <a href="">Lien</a>
            </h2>
        </header>
        <section class="conteneur">
            <nav>
     
    <!-- Début code du test -->
     
     
     
    <!-- Fin code du test -->
     
            </nav>
            <article>
     
    <!-- Début code du test -->
     
    <button id="btnToggle">Toggle animate</button>
    <div id="_2">
        <div id="_2a"></div>  
        <div id="_2b"></div>
        <div id="_2c"></div>
        <div id="_2d"></div>  
        <div id="console">0</div>        
    </div>
     
     
    <!-- Fin code du test -->
     
            </article>
            <article class="qunit">
                <div id="qunit"></div>
                <div id="qunit-fixture"></div>
            </article>
        </section>
        <footer class="h-entry">
            <time class="dt-published" datetime="2014-01-22T10:36:43.443+0100">2014-01-22T10:36:43.443+0100</time>
            <a class="p-author h-card" href="http://www.developpez.net/forums/u285162/danielhagnoul/">Daniel Hagnoul</a>
            <a class="u-url" href="http://danielhagnoul.developpez.com/">Mon cahier d’exercices</a>
            <a class="u-url" href="http://javascript.developpez.com/faq/jquery/">FAQ</a>
            <a class="u-url" href="http://javascript.developpez.com/cours/?page=frameworks#jquery">Tutoriels</a>
        </footer>
        <script>
            "use strict";
            /*
             * Chargeur de code head.js, document ready et fichiers chargés.
             */
            head.ready( [ 
                    "d3", "d3Hello", 
                    "jquery", "jqueryui", "datefr",
                    "qunit", "testsQUnit"
                ], function(){
     
    /* Début code du test */
     
    $( function(){ // forme abrégée de $(document).ready(function(){
     
        var pos = [
                [ 9, 0, 25 ],
                [ 9, 9, 50 ],
                [ 0, 9, 75 ],
                [ 0, 0, 100 ]
            ],
            jObjs=[
                $( '#_2a' ),
                $( '#_2b' ),
                $( '#_2c' ),
                $( '#_2d' )
            ],
            boolToggle = false,
            n = jObjs.length,
            time = 800,
            count = -1,
            jObjConsole = $( "#console" ),
            throwJQ = function(){
                count++;
                jObjConsole.text( count );
     
                for ( var i = 0; i < n; i++ ){
                    jObjs[i].animate(
                        { 
                            "left" : pos[ ( count + i ) % 4 ][ 0 ] + "em", 
                            "top" : pos[ ( count + i ) % 4 ][ 1 ] + "em",
                            "deg" : 90,
                            "scale" : pos[ ( count + i ) % 4 ][ 2 ] 
                        }, 
                        {
                            "duration" : time,
                            "easing" : "easeInOutQuad",
                            "step" : function( now, fx ){
                                if ( fx.prop == "deg" ){ // now est deg
                                    $( this ).css( "transform", "rotate(" + now + "deg)" );
                                }
                                if ( fx.prop == "scale" ){ // now est scale
                                    /*
                                     * s doit varier de 0.0 à 1.0
                                     * mais now doit être un entier qui varie de 0 à 100
                                     */
                                    var s = now / 100;
                                    $( this ).css( "transform", "scale(" + s + "," + s + ")" );
                                }
                            },
                            "complete" : function(){
                                if ( ( this == jObjs[ 3 ].get( 0 ) ) && ( boolToggle == false ) ){
                                    throwJQ();
                                }
                            }
                        }
                     );
                }
            };
     
        $( "#btnToggle" ).on( "click", function(){
            boolToggle = ! boolToggle;
     
            if ( boolToggle == false ) throwJQ();
        });
     
        throwJQ();
     
    });
     
    /* Fin code du test */
     
                if ( debugBool ){
                   console.log( ISOformat( new Date() ) );
     
                    $( ".qunit" ).show();
     
                    testQUnitSelector( "App", [ 
                        "#qunit", "#qunit-fixture", ".conteneur"
                    ] );
     
                    testQUnitID( "App", [ 
                        "qunit", "qunit-fixture"
                    ] );
                }
     
            });
        </script>
    </body>
    </html>

    Blog

    Sans l'analyse et la conception, la programmation est l'art d'ajouter des bogues à un fichier texte vide.
    (Louis Srygley : Without requirements or design, programming is the art of adding bugs to an empty text file.)

  16. #16
    Membre confirmé Avatar de 01001111
    Homme Profil pro
    Développeur Web
    Inscrit en
    Janvier 2009
    Messages
    319
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Haute Loire (Auvergne)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Multimédia et Internet

    Informations forums :
    Inscription : Janvier 2009
    Messages : 319
    Points : 509
    Points
    509
    Par défaut
    ok, je vois! Tu pourrais même eviter le ratio /100 en changeant les deuxièmes index dans chaque ligne du tableau pos.
    0x4F

Discussions similaires

  1. Tchat Home-Made PHP - Windows Live Messenger
    Par SpYd3r dans le forum Langage
    Réponses: 2
    Dernier message: 13/07/2011, 16h19
  2. Problème de connexion entre WebParts "home made"
    Par pcr92 dans le forum SharePoint
    Réponses: 0
    Dernier message: 16/10/2007, 13h39
  3. [GCC]Faire compiler du C vers une machine "home-made"
    Par progfou dans le forum Autres éditeurs
    Réponses: 4
    Dernier message: 18/08/2006, 13h00
  4. Réponses: 5
    Dernier message: 09/12/2002, 22h23
  5. compatibilité des librairies directX8
    Par Freakazoid dans le forum DirectX
    Réponses: 3
    Dernier message: 23/05/2002, 21h33

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo