pixi制作水泡效果

代码语言:html

所属分类:粒子

下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">

<title> - Pixi Sprite Bubbles</title>
<style>
    body {
	margin: 0;
	padding: 0;
	text-align: center;
	text-transform: uppercase;
	font-family: Arial, Helvetica, sans-serif;
	overflow: hidden;
}
p {
	position: absolute;
	color: #fff;
	width: 100%;
	bottom: 45%;
	pointer-events: none;
}
  </style>

</head>
<body translate="no">
<p>Drag!</p>

<script>
var Vector = function(_x, _y) {
    this.x = _x || 1;
    this.y = _y || 0;
    this.setAngle = function(angle) {
        var length = this.getLength();
        this.x = Math.cos(angle) * length;
        this.y = Math.sin(angle) * length;
    }
    this.getAngle = function() {
        return Math.atan2(this.y, this.x);
    }
    this.setLength = function(length) {
        var angle = this.getAngle();
        this.x = Math.cos(angle).........完整代码请登录后点击上方下载按钮下载查看

网友评论0