js实现canvas文字挂在绳子上的弹性交互效果代码

代码语言:html

所属分类:拖放

代码描述:js实现canvas文字挂在绳子上的弹性交互效果代码

代码标签: 文字 挂在 绳子 弹性 交互 效果

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

<!doctype html>
<html>
<head>
<meta charset="utf-8">


<style>
body, html {
	position: absolute;
	margin: 0;
	padding: 0;
	width: 100%;
	height: 100%;
	overflow: hidden;
	touch-action: none;
	content-zooming: none;
	background: #000;
}

canvas {
	position: absolute;
	width: 100%;
	height: 100%;
	user-select: none;
	background: #000;
}
</style>

</head>
<body>

<div></div>

<script>
"use strict";
{
	const txt = 'EXPANDED';
	const viscosity = 0.005;
	const stiffness = 0.99;
	class Point {
		constructor (i, x, y) {
			this.c = null;
			this.x0 = x;
			this.y0 = y;
			this.x = x + Math.sin(i) * 100;
			this.y = y + Math.cos(i) * 100;
			this.vx = 0.0;
			this.vy = 0.0;
			this.a = 0.0;
			this.s = 0.0;
			this..........完整代码请登录后点击上方下载按钮下载查看

网友评论0