...and if one does download the source code and opens even just main.js in wordpad, you will see why AS will be around for a bit of a while yet, unless there are lots of JS gods around.
Here is just a little tiny snippet of the code from one of the 9 javascripts used with this color cycle engine to make the color cycle animation -
NOTE: the code is released under the LGPL v3.0 licence so I don't think I am breaching any copyright by re-publishing a snippet here.Code:if (this.clock % this.settings.targetFPS == 0) $('d_debug').innerHTML = 'FPS: ' + FrameCount.current; } this.bmp.palette.cycle( this.bmp.palette.baseColors, GetTickCount(), this.settings.speedAdjust, this.settings.blendShiftEnabled ); if (this.highlightColor > -1) { this.bmp.palette.colors[ this.highlightColor ] = new Color(255, 255, 255); } if (this.globalBrightness < 1.0) { // bmp.palette.fadeToColor( pureBlack, 1.0 - globalBrightness, 1.0 ); this.bmp.palette.burnOut( 1.0 - this.globalBrightness, 1.0 ); } this.bmp.render( this.imageData, (this.lastBrightness == this.globalBrightness) && (this.highlightColor == this.lastHighlightColor) ); this.lastBrightness = this.globalBrightness; this.lastHighlightColor = this.highlightColor; this.ctx.putImageData( this.imageData, 0, 0 ); TweenManager.logic( this.clock ); this.clock++; FrameCount.count(); this.scaleAnimate(); if (this.inGame) setTimeout( function() { CanvasCycle.animate(); }, 1000 / this.settings.targetFPS ); } }, scaleAnimate: function() { // handle scaling image up or down if (this.settings.zoomFull) { // scale up to full size var totalNativeWidth = this.contentSize.width + this.contentSize.optionsWidth; var maxScaleX = (this.winSize.width - 30) / totalNativeWidth; var totalNativeHeight = this.contentSize.height; var maxScaleY = (this.winSize.height - 30) / totalNativeHeight; var maxScale = Math.min( maxScaleX, maxScaleY ); if (this.contentSize.scale != maxScale) { this.contentSize.scale += ((maxScale - this.contentSize.scale) / 8); if (Math.abs(this.contentSize.scale - maxScale) < 0.001) this.contentSize.scale = maxScale; // close enough




Reply With Quote