欢迎光临好看6音画空间---交流网页音画技术,共享音画乐趣!
  首页 Flash技术 PS技术 网页特效 Q Q空间 音画欣赏 祝福网页 素材图库  
 
>>  您现在的位置: 好看6音画空间 >> Flash技术>> 文章
 
 
 

制作软翻页相册

  文章来源: 本站   更新日期: 2010-03-18    阅读:
 
 

最终效果预览:

flash相册代码: -

import flash.geom.Point; -

//---const -

var RTOA:Number = 180/Math.PI; -

var ATOR:Number = Math.PI/180; -

var P360:Number = Math.PI*2; -

//base function -

//获得两个Point之间的夹角 -

function getAngle(point_a:Point, point_b:Point):Number { -

return Math.atan2(point_b.y-point_a.y, point_b.x-point_a.x); -

} -

//获取由三个点构成的两条线ab bc之间的夹角 -

function getPointAngle(point_a:Point, point_b:Point, point_c:Point):Number { -

var angle:Number = getAngle(point_b, point_a)-getAngle(point_b, point_c); -

if (angle>Math.PI*2) { -

angle -= Math.PI*2; -

} else if (angle>=Math.PI) { -

angle -= Math.PI; -

} else if (angle<=-Math.PI) { -

angle += Math.PI*2; -

} else if (angle<0) { -

angle += Math.PI; -

} -

return angle; -

} -

//判断一条直线上,a点是否位于b、c点之间,如果位于,返回比较靠近的点,否则返回undefined -

function aInBC(a:Point, b:Point, c:Point):Boolean { -

return Point.distance(a, b)+Point.distance(a, c)<=Point.distance(b, c)+1 -

} -

//得到斜率 -

function getK(point_1:Point, point_2:Point):Number { -

var k:Number; -

if (point_2.y == point_1.y) { -

k = 0.000001; -

} else if (point_2.x == point_1.x) { -

k = 1000000 -

} else { -

k = (point_2.y-point_1.y)/(point_2.x-point_1.x); -

} -

return k; -

} -

//point_a到由point_1和point_2构成的直线的垂直交点(法线点) -

function pointToLine(point_1:Point, point_2:Point, point_a:Point):Point { -

//斜率K -

var k1:Number; -

var k2:Number; -

//偏移量a -

var a1:Number; -

var a2:Number; -

var point_b:Point = new Point(); -

k1 = getK(point_1, point_2); -

k2 = -1/k1; -

a1 = point_1.y-k1*point_1.x; -

a2 = point_a.y-k2*point_a.x; -

point_b = new Point(); -

point_b.x = (a2-a1)/(k1-k2); -

point_b.y = k1*point_b.x+a1; -

return point_b; -

} -

//point_a到由point_1和point_2构成的直线的距离 -

function distancePointToLine(point_1:Point, point_2:Point, point_a:Point):Number { -

var point_b:Point = new Point(); -

point_b = PointToLine(point_1, point_2, point_a); -

return Point.distance(point_a, point_b); -

} -

//两条直线的交点 -

function crossPoint(p1:Point,k1:Number ,p2:Point ,k2:Number):Point{ -

var c:Point=new Point() -

if(k1==k2){ -

return undefined -

}else{ -

c.x=(p1.y-k1*p1.x-p2.y+k2*p2.x)/(k1-k2) -

c.y=(k1*c.x+p1.y-k1*p1.x) -

} -

 

  

· 上一篇: 制作文字变换效果  
· 下一篇: 按钮的基本应用  
 
 

版权所有: 好看6 - 音画空间网站 2007-2008 汇集音画技术 共享音画乐趣

Copyright@2007-2008 www.haokan6.cn Template designed by风的声音 客服QQ:492105278 Email: fqyd_a@126.com
最佳分辨率 1024x768