v26110450 宝宝踢腿时点脚弹实心红心;消消乐推广条去掉外层白框
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
/* 页面版本号(YYMMDD+序号):显示在「关于兜爸心选」页底部;bump 时同步 head 注释与 ?v= */
|
||||
var VER = '26110449';
|
||||
var VER = '26110450';
|
||||
const $ = (s, c) => (c || document).querySelector(s);
|
||||
const $$ = (s, c) => Array.from((c || document).querySelectorAll(s));
|
||||
|
||||
|
||||
@@ -195,13 +195,47 @@
|
||||
const f = cfg.l.findIndex(x => x[6] === 'foot');
|
||||
if (l[6] === 'leg' && f >= 0 && Math.random() < .4)
|
||||
moves.push({ i: f, t0: now + 300, dur: dur - 200, amp: -dir * cfg.l[f][5] * .7 * (DEBUG ? 4 : 1) * Math.PI / 180 });
|
||||
if (l[6] === 'leg' || l[6] === 'foot') kickSound(dur * .3); // 踢到最快那一下时响(缓起缓落,约 3 成处)
|
||||
if (l[6] === 'leg' || l[6] === 'foot') {
|
||||
kickSound(dur * .3);
|
||||
kickUntil = now + dur + 800; // 踢的这段时间(+0.8 秒宽限)点脚弹红心
|
||||
kickIdx = [i]; if (f >= 0 && f !== i && moves.some(m => m.i === f)) kickIdx.push(f);
|
||||
} // 踢到最快那一下时响(缓起缓落,约 3 成处)
|
||||
kick();
|
||||
}
|
||||
plan();
|
||||
}, DEBUG ? 900 + Math.random() * 600 : 4000 + Math.random() * 5000);
|
||||
}
|
||||
|
||||
/* 11-05 用户:「当婴儿踢的时候,点击这个踢的位置,弹出一个实心的红心」
|
||||
→ 小腿 / 小脚正在动(含动完后 0.8 秒宽限)时,点到那只脚附近(以末端为中心、原图 70px 半径,手指粗所以放宽)就在点的位置弹一颗实心红心:
|
||||
放大弹出 → 往上飘 → 淡出,约 1 秒。小胳膊动、或没在踢的时候点,不弹。
|
||||
· 头图宝宝那层是 pointer-events:none(不挡下面的点击),所以这里在 document 上听 pointerdown 再按坐标判断,不拦截、不影响原有点击。
|
||||
· 调试 limbdebug=1 时任何时候点脚附近都弹,方便看效果。 */
|
||||
const hs = document.createElement('style');
|
||||
hs.textContent = '.kick-heart{position:fixed;z-index:9999;width:34px;height:34px;margin:-17px 0 0 -17px;pointer-events:none;' +
|
||||
'animation:khPop 1.1s cubic-bezier(.2,.8,.3,1) forwards;filter:drop-shadow(0 3px 6px rgba(220,30,60,.35))}' +
|
||||
'@keyframes khPop{0%{transform:scale(.2);opacity:0}18%{transform:scale(1.25);opacity:1}32%{transform:scale(.95)}45%{transform:scale(1.05) translateY(-6px);opacity:1}65%{opacity:1}100%{transform:scale(1) translateY(-46px);opacity:0}}';
|
||||
document.head.appendChild(hs);
|
||||
let kickUntil = 0, kickIdx = [];
|
||||
function heartAt(x, y) {
|
||||
const h = document.createElement('div');
|
||||
h.className = 'kick-heart';
|
||||
h.style.left = x + 'px'; h.style.top = y + 'px';
|
||||
h.innerHTML = '<svg viewBox="0 0 24 24" width="34" height="34"><path d="M12 21.2l-1.4-1.3C5.4 15.3 2 12.2 2 8.4 2 5.3 4.4 3 7.4 3c1.8 0 3.5.8 4.6 2.2C13.1 3.8 14.8 3 16.6 3 19.6 3 22 5.3 22 8.4c0 3.8-3.4 6.9-8.6 11.5z" fill="#F0284A"/></svg>';
|
||||
document.body.appendChild(h);
|
||||
setTimeout(() => h.remove(), 1100);
|
||||
}
|
||||
addEventListener('pointerdown', e => {
|
||||
if (!ready || !cfg || !cv.classList.contains('is-on')) return;
|
||||
if (!DEBUG && performance.now() > kickUntil) return;
|
||||
const r = cv.getBoundingClientRect();
|
||||
if (!r.width || e.clientX < r.left - 30 || e.clientX > r.right + 30 || e.clientY < r.top - 30 || e.clientY > r.bottom + 30) return;
|
||||
const k = 480 / r.width, qx = (e.clientX - r.left) * k, qy = (e.clientY - r.top) * k;
|
||||
const idx = DEBUG ? cfg.l.map((l, i) => i).filter(i => cfg.l[i][6] !== 'arm') : kickIdx;
|
||||
if (idx.some(i => { const l = cfg.l[i]; return Math.hypot(qx - l[2], qy - l[3]) < 70 || Math.hypot(qx - (l[0] + l[2]) / 2, qy - (l[1] + l[3]) / 2) < 60; }))
|
||||
heartAt(e.clientX, e.clientY);
|
||||
}, { passive: true, capture: true });
|
||||
|
||||
// 跟着 #heroStill:换图时重新载贴图,静图淡出时画布一起淡出
|
||||
function sync() {
|
||||
const m = (still.getAttribute('src') || '').match(/([0-9a-f]{12})\.png/);
|
||||
|
||||
@@ -244,5 +244,5 @@
|
||||
}
|
||||
/* feed.js 首页默认不加载(index.html 只引了 topics.js),这里按需拉一次 */
|
||||
if (window.GC_FEED) init();
|
||||
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110449'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
||||
else { var fs = document.createElement('script'); fs.src = 'guangchang/feed.js?v=26110450'; fs.onload = fs.onerror = init; document.body.appendChild(fs); }
|
||||
})();
|
||||
|
||||
@@ -6,9 +6,9 @@
|
||||
(function () {
|
||||
var sec = document.getElementById('gcHome');
|
||||
if (!sec) return;
|
||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110449';
|
||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/gch/v4.css?v=26110450';
|
||||
document.head.appendChild(l);
|
||||
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110449';
|
||||
var s = document.createElement('script'); s.src = 'js/gch/v4.js?v=26110450';
|
||||
s.onload = function () { if (sec.querySelector('.g4-foot')) merge(); else sec.addEventListener('gc4-ready', merge, { once: true }); }; /* v4 要先拉 feed.js 才渲染 */
|
||||
document.body.appendChild(s);
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
if (/[?&]kit=0(?:&|$)/.test(location.search)) return;
|
||||
var box = document.getElementById('kit'), sec = document.getElementById('kitHome');
|
||||
if (!box || !sec) return;
|
||||
var V = '26110449';
|
||||
var V = '26110450';
|
||||
var l = document.createElement('link'); l.rel = 'stylesheet'; l.href = 'js/kit.css?v=' + V; document.head.appendChild(l);
|
||||
document.documentElement.classList.add('has-kit');
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
postMessage 不是实时投递,微信在分享那一刻才派发,所以每次换内容都要再报一次;子页面没引 jweixin,这里按需加载。 */
|
||||
(function (g) {
|
||||
'use strict';
|
||||
var V = '26110449';
|
||||
var V = '26110450';
|
||||
var isWx = /MicroMessenger/i.test(navigator.userAgent || '');
|
||||
var waiting = [], loading = false;
|
||||
function ready(cb) {
|
||||
|
||||
Reference in New Issue
Block a user