1Dec/090
Feature Test Post
This post i meant to test a few of the plugins I recently installed.
- The shadowbox plugin. (Flash Snow, Flash Fireworks, a YouTube Video)
- Syntax Highlighting (WP-Syntax with some tweaks)
PHP/** * Calculates the start and end date of a given week. * @param int $week The week number * @param int $year The year * @return array array('begins' => 'date', 'ends' => 'date') */ public static function get_week_range($week, $year) { $week = str_pad($week, 2, 0, STR_PAD_LEFT); // ISO 8601 says weeks must have 2 characters (01, 02, 03 etc) return array( 'begins' => date('Y-m-d', strtotime($year.'W'.$week.'1')), 'ends' => date('Y-m-d', strtotime($year.'W'.$week.'7')), ); }AS3
/** * This function creates the velocities for a spherical * explosion and adds them to the stack. */ private function spherical(r:Number, speed:Number):void { for (var i:uint = 0; i < this.density; i++) { var s:spark = new spark( .5, this.color); var theta:Number = Math.random() * Math.PI*2; var phi:Number = Math.random() * Math.PI*2; //var r:Number = Math.floor(Math.random() * 1 + 2); s.vx = r * Math.sin(theta) * Math.cos(phi) * speed; s.vy = r * Math.sin(theta) * Math.sin(phi) * speed; s.vz = r * Math.cos(theta) * 1.2; sparks.push(s); addChild(s); } }JavaScript
<script type="text/javascript"> var angle = 0; var step = 1; var radiusX = 200; var radiusY = 100; var count = 20; var centerX, centerY; $(document).ready(function() { centerX = $('body').width() / 2; centerY = $('body').height() / 2; for(var i = 0; i < count; i++) { $('<img src="accept.png" alt="" id="fly'+i+'"/>').appendTo('body'); } setInterval('move()', 25); }); function move() { var x, y; for(var i = count; i >= 0; i--) { x = centerX + Math.cos((angle - (step * 2 * i)) * Math.PI / 180) * radiusX; y = centerY + Math.sin((angle - (step * 2 * i)) * Math.PI / 180) * radiusY; $('#fly'+i).css('left', x-8).css('top', y-8).css('opacity', 1 / (i +1)); } angle += step; } </script>