结婚html5 在线制作,HTML5 果冻特效的文本在线制作工具
JavaScript
语言:
JaveScriptBabelCoffeeScript
确定
/* App
*/
var app = {
presets: [
/* Respectively
{scale | speed | cursor | width} | {composite | night} | {shader | rr | rg | rb | ra | r1 | gr | gg | gb | ga | g1 | br | bg | bb | ba | b1 | ar | ag | ab | aa | a1}
*/
{
name: 'Default',
value: '4.51 31.58 285.71 10 normal 0 1 0 0 0 1 0 0 0 0 0.5 0.8 0 0 0 0 0 -0 0 0 40 -5'
}, {
name: 'Fluid',
value: '4.51 31.58 285.71 10 multiply 0 1 0.7 -1 1 0 1.3 0 -1 1 0 0 1 -1 1 -1 0 0 0 0 30 -5'
}, {
name: 'Pink',
value: '5 75 2000 10 difference 1 1 0 0 0 0 .6 0 0 0 .5 -.3 0 0 0 2 0 0 0 0 30 -5'
}, {
name: 'Fire',
value: '5 20 175 10 multiply 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 0 0 0 0 0 10 -5'
}, {
name: 'Original',
value: '4.51 31.58 285.71 10 multiply 0 0 0.7 -1 1 0 1.3 0 -1 1 0 0 1 -1 1 -1 0 0 0 0 30 -5'
}, {
name: 'Sharp',
value: '4.51 31.58 285.71 10 multiply 0 1 0 0 0 0 0 0 1.1 0 0 0 1 -1 -0.7 0 0.1 0 0 0 100 -20'
}, {
name: 'Neon',
value: '4.51 31.58 285.71 10 multiply 1 1 0 0 0 0 1 0 -1 1 2.8 -1 0.7 0.3 -0.5 0.5 1 0 0 0 30 -5'
}, {
name: 'Hot',
value: '4.51 31.58 285.71 10 multiply 1 1 0 0 0 1.6 2 0 0 2 5 -1.1 0 1.3 0 0 0.1 0 0 0 30 -5'
}, {
name: 'Energy',
value: '3.38 -75.94 436.09 3 screen 1 1 0 0 0 1.7 0.8 0 0 2 5 -1.1 0 1.3 0 0 0.1 0.7 0 0 10 -0.6'
}
],
config: {}, // Nothing here, since the first preset in the list is loaded by default.
storage: {
dragging: false,
isdemo: true,
path: [],
shapes: [],
last: null,
composites: ["normal", "multiply", "screen", "overlay", "darken", "lighten",
"color-dodge", "color-burn", "hard-light", "soft-light",
"difference", "exclusion", "hue", "saturation", "color",
"luminosity", "clear", "copy", "destination", "source-over",
"destination-over", "source-in", "destination-in", "source-out",
"destination-out", "source-atop", "destination-atop", "xor", "lighter"
],
order: ['scale', 'speed', 'cursor', 'linewidth', 'composite', 'night', 'shader',
'rr', 'rg', 'rb', 'ra', 'r1',
'gr', 'gg', 'gb', 'ga', 'g1',
'br', 'bg', 'bb', 'ba', 'b1',
'ar', 'ag', 'ab', 'aa', 'a1'
]
}
}
/* Menu
*/
$('.trigger-menu').on('click', function(e) {
e.stopPropagation();
$('#wrapper').toggleClass('wrapped');
})
$('.trigger-clear').on('click', function(e) {
app.storage.shapes = [];
})
$('.trigger-save').on('click', function() {
if (typeof(Storage) === "undefined")
return alert('Sorry! No Web Storage support...');
var presets = JSON.parse(localStorage['presets'] || null) || [],
name = prompt('Name this preset', 'preset_' + presets.length),
values = [];
if (!name)
return;
var order = app.storage.order;
app.storage.order.forEach(function(input) {
if (!$('#' + input).length)
return;
var $input = $('#' + input);
if ($input.is('[type="checkbox"]'))
values.push($input.prop('checked') ? '1' : '0');
else
values.push($input.val());
})
if (values.length != order.length)
return alert('Sorry! The configuration length & input order length doesn\'t match...');
presets.push({
name: name,
value: values.join(' ')
});
localStorage.setItem('presets', JSON.stringify(presets));
$('#preset').append('' + name + '');
});
$('.canvas').on('click', function() {
$('#wrapper').removeClass('wrapped');
})
/* Controls (sidebar)
*/
if (typeof Storage !== 'undefined')
app.presets = app.presets.concat(JSON.parse(localStorage['presets'] || null) || []);
app.presets.forEach(function(preset, index) {
$('#preset').append('' + preset.name + '');
});
app.storage.composites.forEach(function(composite) {
$('#composite').append('' + composite + '');
})
$('[data-config]').on('change', function() {
app.config[$(this).data('config')] = $(this).val();
});
$('[data-config="width"]').on('change', function() {
document.getElementById('width').setAttribute('stdDeviation', $(this).val());
});
$('[data-shader]').on('change', function() {
var order = ['r', 'g', 'b', 'a', '1'],
value = [];
for (var x = 0; x < 4; x++) {
for (var y = 0; y < 5; y++) {
if (!$('#' + order[x] + order[y]).length)
continue;
value.push(parseFloat(Number($('#' + order[x] + order[y]).val()).toFixed(2)));
}
}
document.getElementById('matrix').setAttribute('values', value.join(' '));
});
$('#shader').on('change', function() {
$(this).prop('checked') ? $('body').addClass('has-shader') : $('body').removeClass('has-shader');
});
$('#night').on('change', function() {
$(this).prop('checked') ? $('body').addClass('has-night') : $('body').removeClass('has-night');
});
function handleTouche(e) {
var original = e.originalEvent;
if (original && window.TouchEvent && original instanceof TouchEvent) {
if (original.changedTouches && original.changedTouches.length)
return {
x: original.changedTouches[0].clientX,
y: original.changedTouches[0].clientY
};
else if (original.targetTouches && original.targetTouches.length)
return {
x: original.targetTouches[0].clientX,
y: original.targetTouches[0].clientY
};
} else {
return {
x: e.clientX,
y: e.clientY
};
}
}
$('.slider').each(function() {
var $slider = $(this),
$input = $(this).find('input'),
min = typeof $(this).data('min') === 'undefined' ? 1 : $(this).data('min'),
max = typeof $(this).data('max') === 'undefined' ? 100 : $(this).data('max'),
step = $(this).data('step') || 0,
acc = $(this).data('accuracy') || 0,
vertical = $(this).hasClass('slider-vertical');
var $thumb = $(this).find('.slider-thumb');
$thumb.on('mousedown touchstart', function() {
clearTimeout(app.storage.timeoutDragging);
app.storage.dragging = $input;
});
$input.data('update', function(e, animate, def) {
if (e) {
var coordinates = handleTouche(e);
var mouse = vertical ? (coordinates.y - $slider.offset().top) / $slider.height() : (coordinates.x - $slider.offset().left) / $slider.width(),
value = min + ((vertical ? 1 - mouse : mouse) * (max - min));
value = +(Math.max(min, Math.min(max, step ? Math.round(value / step) * step : value))).toFixed(acc);
} else {
var value = def ? def : $input.val();
}
var percent = (((value - min) / (max - min)) * 100) + '%';
if (animate) {
vertical ? $thumb.animate({
'bottom': percent
}, {
duration: 1000
}) : $thumb.animate({
'left': percent
}, {
duration: 1000,
step: function(i) {
var a = (min + (i / 100) * (max - min)).toFixed(acc);
$input.val(a).trigger('change');
$('label[for="' + ($input.attr('id')) + '"]').length && $('label[for="' + ($input.attr('id')) + '"]').find('span').html(a);
},
complete: function() {
$input.val(value).trigger('change');
$('label[for="' + ($input.attr('id')) + '"]').length && $('label[for="' + ($input.attr('id')) + '"]').find('span').html(value);
}
});
} else {
vertical ? $thumb.css({
'bottom': percent
}) : $thumb.css({
'left': percent
});
$('label[for="' + ($input.attr('id')) + '"]').length && $('label[for="' + ($input.attr('id')) + '"]').find('span').html(value);
$input.val(value).trigger('change');
}
});
$(this).on('click', function(e) {
if (app.storage.dragging)
return;
$input.data('update')(e, true);
})
});
$(document).on('mouseup', function() {
app.storage.timeoutDragging = setTimeout(function() {
app.storage.dragging = false;
}, 100);
}).on('mousemove', function(e) {
if (!app.storage.dragging)
return;
var $input = app.storage.dragging;
$input.data('update')(e);
})
$('#preset').on('change', function() {
var order = app.storage.order,
value = $(this).val();
value.split(' ').forEach(function(v, i) {
if (!order[i] || !$('#' + order[i]).length)
return;
var $input = $('#' + order[i]);
if ($input.data('update')) {
$input.data('update')(null, order[i] == 'cursor' ? false : true, v);
} else if ($input.is('[type="number"]')) {
$({
a: $input.val()
}).animate({
a: v
}, {
duration: 1000,
step: function(i) {
$input.val(i.toFixed(1)).trigger('change');
},
complete: function() {
$input.val(v).trigger('change');
}
});
} else if ($input.is('[type="checkbox"]')) {
$input.prop('checked', v == 1 ? true : false).trigger('change');
} else {
$input.val(v).trigger('change');
}
});
}).trigger('change');
/* Drawing
*/
var temporary = document.querySelector('canvas#temporary'),
temporaryCtx = temporary.getContext('2d'),
render = document.querySelector('canvas#render'),
renderCtx = render.getContext('2d');
render.width = temporary.width = window.innerWidth;
render.height = temporary.height = window.innerHeight;
temporaryCtx.strokeStyle = "#ccc";
$(render).on('mousedown touchstart', function(e) {
if (app.storage.isdemo) {
app.storage.shapes = [];
app.storage.isdemo = false;
}
var coordinates = handleTouche(e);
app.storage.path = [coordinates];
temporaryCtx.beginPath();
temporaryCtx.moveTo(coordinates.x, coordinates.y);
}).on('mousemove touchmove', function(e) {
if (!app.storage.path.length)
return;
var now = +new Date();
var last = app.storage.path[app.storage.path.length - 1];
var coordinates = handleTouche(e);
if (last.x == coordinates.x && last.y == coordinates.y)
return;
if (now - app.storage.last > 50 && Math.sqrt((last.x - coordinates.x) * (last.x - coordinates.x) + (last.y - coordinates.y) * (last.y - coordinates.y)) > 10) {
app.storage.path.push({
x: coordinates.x,
y: coordinates.y
});
app.storage.last = now;
}
temporaryCtx.lineTo(coordinates.x, coordinates.y);
temporaryCtx.stroke();
temporaryCtx.beginPath();
temporaryCtx.moveTo(coordinates.x, coordinates.y);
}).on('mouseup touchend touchcancel touchleave mouseleave', function(e) {
if (!app.storage.path.length)
return;
var coordinates = handleTouche(e);
temporaryCtx.lineTo(coordinates.x, coordinates.y);
temporaryCtx.stroke();
app.storage.path.push({
x: coordinates.x,
y: coordinates.y
});
temporary.width = temporary.width;
temporaryCtx.strokeStyle = "#ccc";
app.storage.shapes.push(app.storage.path);
app.storage.path = [];
});
function drawPath(time, color, offset) {
renderCtx.strokeStyle = color;
var offset = offset || 0;
app.storage.shapes.forEach(function(path, index) {
renderCtx.beginPath();
var shapeid = index;
path.forEach(function(curve, index) {
var thisVariation = app.config.scale * Math.sin(((index * app.config.cursor + time) / (path.length * app.config.speed)) + offset);
var thisCurve = {
x: curve.x + thisVariation,
y: curve.y + thisVariation
};
if (!index)
renderCtx.moveTo(thisCurve.x, thisCurve.y);
else if (index != path.length - 1) {
var nextVariation = app.config.scale * Math.sin((((index + 1) * app.config.cursor + time) / (path.length * app.config.speed)) + offset);
var nextCurve = {
x: path[index + 1].x + nextVariation,
y: path[index + 1].y + nextVariation
};
var xc = (thisCurve.x + nextCurve.x) / 2;
var yc = (thisCurve.y + nextCurve.y) / 2;
renderCtx.quadraticCurveTo(thisCurve.x, thisCurve.y, xc, yc);
}
});
renderCtx.stroke();
});
}
function animate(time) {
render.width = render.width;
renderCtx.globalCompositeOperation = app.config.composite;
renderCtx.lineWidth = 5;
renderCtx.lineCap = "round";
drawPath(time, 'rgb(255, 0, 0)', 1000);
drawPath(time, 'rgb(0, 255, 0)', 2000);
drawPath(time, 'rgb(0, 0, 255)', 3000);
return requestAnimationFrame(animate);
}
animate();
$(window).resize(function() {
render.width = temporary.width = window.innerWidth;
render.height = temporary.height = window.innerHeight;
});
function demo() {
var shapes = [
[{
"x": 585,
"y": 125
}, {
"x": 588,
"y": 136
}, {
"x": 592,
"y": 218
}, {
"x": 594,
"y": 296
}, {
"x": 595,
"y": 307
}],
[{
"x": 580,
"y": 133
}, {
"x": 591,
"y": 129
}, {
"x": 668,
"y": 128
}, {
"x": 725,
"y": 186
}, {
"x": 713,
"y": 243
}, {
"x": 610,
"y": 284
}, {
"x": 533,
"y": 294
}, {
"x": 524,
"y": 290
}],
[{
"x": 756,
"y": 123
}, {
"x": 758,
"y": 133
}, {
"x": 764,
"y": 203
}, {
"x": 774,
"y": 279
}, {
"x": 776,
"y": 302
}, {
"x": 776,
"y": 303
}],
[{
"x": 764,
"y": 121
}, {
"x": 773,
"y": 115
}, {
"x": 829,
"y": 110
}, {
"x": 875,
"y": 133
}, {
"x": 884,
"y": 152
}, {
"x": 850,
"y": 161
}, {
"x": 806,
"y": 170
}, {
"x": 806,
"y": 181
}, {
"x": 849,
"y": 243
}, {
"x": 890,
"y": 296
}, {
"x": 895,
"y": 302
}],
[{
"x": 922,
"y": 288
}, {
"x": 926,
"y": 278
}, {
"x": 949,
"y": 217
}, {
"x": 972,
"y": 135
}, {
"x": 979,
"y": 112
}, {
"x": 986,
"y": 120
}, {
"x": 1028,
"y": 209
}, {
"x": 1073,
"y": 281
}, {
"x": 1088,
"y": 314
}, {
"x": 1088,
"y": 314
}],
[{
"x": 951,
"y": 245
}, {
"x": 961,
"y": 244
}, {
"x": 1037,
"y": 238
}, {
"x": 1045,
"y": 237
}],
[{
"x": 1053,
"y": 108
}, {
"x": 1058,
"y": 121
}, {
"x": 1096,
"y": 194
}, {
"x": 1130,
"y": 251
}, {
"x": 1137,
"y": 268
}, {
"x": 1139,
"y": 257
}, {
"x": 1151,
"y": 210
}, {
"x": 1159,
"y": 183
}, {
"x": 1182,
"y": 220
}, {
"x": 1211,
"y": 256
}, {
"x": 1225,
"y": 274
}, {
"x": 1230,
"y": 264
}, {
"x": 1275,
"y": 162
}, {
"x": 1299,
"y": 92
}, {
"x": 1300,
"y": 89
}]
],
position = {
x: null,
y: null,
w: null,
h: null
}
shapes.forEach(function(shape) {
shape.forEach(function(point) {
position.x = Math.min(point.x, position.x || point.x);
position.y = Math.min(point.y, position.y || point.y);
position.w = Math.max(point.x, position.w || point.x);
position.h = Math.max(point.y, position.h || point.y);
});
});
var rW = (window.innerWidth * 0.75) / (position.w - position.x),
rH = (window.innerHeight * 0.75) / (position.h - position.y),
wH = (window.innerWidth / 2 - ((position.w - position.x) * rH) / 2),
hH = (window.innerHeight / 2 - ((position.h - position.y) * rH) / 2),
wW = (window.innerWidth / 2 - ((position.w - position.x) * rW) / 2),
hW = (window.innerHeight / 2 - ((position.h - position.y) * rW) / 2);
shapes.forEach(function(shape) {
shape.forEach(function(point) {
if (rH < rW) {
point.x = (point.x - position.x) * rH + wH;
point.y = (point.y - position.y) * rH + hH;
} else {
point.x = (point.x - position.x) * rW + wW;
point.y = (point.y - position.y) * rW + hW;
}
});
});
app.storage.shapes = shapes;
}
demo();
结婚html5 在线制作,HTML5 果冻特效的文本在线制作工具相关推荐
- Unity教程||Unity添加中文字体||Unity知识记录--制作UI粒子特效
Unity添加中文字体 ## 1.拷贝字体文件 拷贝C:\Windows\Fonts文件夹下,华文细黑常规文件到项目中 ## 2.下载中文字库 链接: https://pan.baidu.com/s/ ...
- 【web前端特效源码】使用HTML5+CSS3+JavaScript制作一个果冻导航标签栏图标按钮效果~~适合初学者~超简单~ |前端开发|IT软件
b站视频演示效果: [web前端特效源码]使用HTML5+CSS3+JavaScript制作一个果冻导航标签栏图标按钮效果~~适合初学者~超简单~ |前端开发|IT软件 效果图: 完整代码: < ...
- h5在线制作html5,在线制作HTML5多媒体作品的技巧
HTML5多媒体作品以其对各种平台的兼容而见长,目前已获得了广泛的应用.如果我们需要制作自己的HTML5多媒体作品,一个方便之选就是利用现成的在线制作工具"百度H5". 首先访问& ...
- php在线对弈,【图片】手把手开始制作HTML5在线五子棋对弈游戏【编程吧】_百度贴吧...
该楼层疑似违规已被系统折叠 隐藏此楼查看此楼 本次课题:制作HTML5在线五子棋对弈游戏. 预计开发周期:还没想好看心情,先预计7天完成. 备注:最近做学校课题有关数据挖掘的,有时候搞得没得头绪,做个 ...
- html网页特效微课,网页设计与制作(HTML5+CSS3+JavaScript)(第4版)(微课版)
网页设计与制作(HTML5+CSS3+JavaScript)(第4版)(微课版) 编辑 锁定 讨论 上传视频 <网页设计与制作(HTML5+CSS3+JavaScript)(第4版)(微课版)& ...
- html5 制作书架展示 PHP,简单做出HTML5翻页效果文字特效
简单做出HTML5翻页效果文字特效 之前在网上看到一款比较有新意的HTML5文字特效,文字效果是当鼠标滑过是出现翻开折叠的效果,类似书本翻页.于是我兴致勃勃的点开源码看了一下,发现其实实现也挺简单的, ...
- html星空代码在线,HTML5特效库 HTML5+JS全屏星空特效源码
效果图 各位长友大家早上好! 今天给各位带来的是 HTML5+JS全屏星空特效源码! 有想要文件版源码的可以私聊小编哦! 废话不多说,上源码! CSS: body {margin:0 auto;ove ...
- 基于HTML5的移动Web应用——Bootstrap 样式案例:制作美联英语在线VIP页面微电影
需求说明 使用container.row等栅格系统的知识布局响应式的网页,需要适配中等屏幕.小屏幕.超小屏幕 使用.img-responsive设置响应式图片,使之适应不同屏幕的终端 使用.img-t ...
- 9款超绚丽的HTML5/CSS3应用和动画特效
HTML5 现在已经不是很前卫的东西了,越来越多的网站和移动应用都在不断地尝试使用HTML5来更好地优化用户体验.今天我们要分享9款超绚丽的HTML5/CSS3应用和动画特效,这里面有菜单.按钮.图片 ...
最新文章
- 基于深度学习方式的点云处理算法汇总
- 区块链还可以这么玩?“点亮莫高窟”背后的腾讯云区块链
- 使用Powershell来修改Hyper-v Server本地管理员密码为永不过期
- MySQL流程控制if、case、循环结构while的使用语法
- 天了噜!定义static字段还有顺序要求?
- 【随记】SQL Server连接字符串参数说明
- matlab 计算汉明距_matlab实现滑动平均滤波
- Outlook2010怎么关联邮箱 Outlook邮箱关联的教程
- Python使用chardet包自动检测编码
- Dave一款gitee热搜项目,不需node基础也能直接部署node
- dis 密集光流_密集光流估计的自监督注意力机制
- python:画图调整图例位置
- 读取位置时发生访问冲突 c++_王道计算机网络|第三章数据链路层1314介质访问控制...
- web网页设计制作成品 ——服装明星主页(7页) 表格带留言板带音乐HTML+CSS+JavaScript
- linux键盘输入空格失效,电脑键盘空格键失灵不能用如何修复
- WPF学习之绘图和动画
- 苹果x屏幕多少钱_北京苹果手机维修为大家分享iPadAir2换屏幕多少钱
- 【原创】博物馆库房环境空气质量无线温湿度监控技术性方案
- 联想E420麦克风没有声音的方案
- axios和layUI配合加载数据表格demo
热门文章
- windows 本地搭建git仓库_搭建Git服务器
- [附源码]java+ssm计算机毕业设计基于JavaEE的电影订票网站系统546sw(源码+程序+数据库+部署)
- 【报告分享】腾讯智慧医疗报告-需求篇-腾讯研究院(附下载)
- GateOne CVE-2020-35736 任意文件读取漏洞复现
- 物流一体化实施方案建议
- ubantu14.04装机
- 微信小程序自定义navigationBar
- 宏碁TravelMate tx50g2配置tensorflow-gpu
- sha 2 java加密_MD5、SHA、SHA-2算法的实现(Java)
- vue 实现计数器,点击按钮数字加减。