ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
路径:D:\ireport365\ireport365.war\js\enduser\designer\vs-component-basic.js 在designer.css里添加五种动画css 路径:D:\ireport365\ireport365.war\js\enduser\designer\designer.css ``` /* 五种时间文字特效 start*/ body .particletext { position: relative; } body .particletext.bubbles > .particle { opacity: 0; position: absolute; background-color: rgba(33, 150, 243, 0.5); -webkit-animation: bubbles 3s ease-in infinite; animation: bubbles 3s ease-in infinite; border-radius: 100%; } body .particletext.hearts > .particle { opacity: 0; position: absolute; background-color: #cc2a5d; -webkit-animation: hearts 3s ease-in infinite; animation: hearts 3s ease-in infinite; } body .particletext.hearts > .particle:before, body .particletext.hearts > .particle:after { position: absolute; content: ''; border-radius: 100px; top: 0px; left: 0px; width: 100%; height: 100%; background-color: #cc2a5d; } body .particletext.hearts > .particle:before { -webkit-transform: translateX(-50%); transform: translateX(-50%); } body .particletext.hearts > .particle:after { -webkit-transform: translateY(-50%); transform: translateY(-50%); } body .particletext.lines > .particle { position: absolute; background-color: rgba(244, 67, 54, 0.5); -webkit-animation: lines 3s linear infinite; animation: lines 3s linear infinite; } body .particletext.confetti > .particle { opacity: 0; position: absolute; -webkit-animation: confetti 3s ease-in infinite; animation: confetti 3s ease-in infinite; } body .particletext.confetti > .particle.c1 { background-color: rgba(76, 175, 80, 0.5); } body .particletext.confetti > .particle.c2 { background-color: rgba(156, 39, 176, 0.5); } body .particletext.fire > .particle { position: absolute; background-color: rgba(255, 193, 7, 0.5); border-radius: 40px; border-top-right-radius: 0px; -webkit-animation: fires 0.8s linear infinite; animation: fires 0.8s linear infinite; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); opacity: 0; } body .particletext.fire > .particle:before { position: absolute; content: ''; top: 60%; left: 40%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 50%; height: 50%; border-radius: 40px; border-top-right-radius: 0px; background-color: rgba(251, 140, 0, 0.5); } body .particletext.sunbeams > .particle { position: absolute; background-color: rgba(253, 216, 53, 0.5); -webkit-animation: sunbeams 3s linear infinite; animation: sunbeams 3s linear infinite; } @-webkit-keyframes bubbles { 0% { opacity: 0; } 20% { opacity: 1; -webkit-transform: translate(0, -20%); transform: translate(0, -20%); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%); transform: translate(0, -1000%); } } @keyframes bubbles { 0% { opacity: 0; } 20% { opacity: 1; -webkit-transform: translate(0, -20%); transform: translate(0, -20%); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%); transform: translate(0, -1000%); } } @-webkit-keyframes hearts { 0% { opacity: 0; -webkit-transform: translate(0, 0%) rotate(45deg); transform: translate(0, 0%) rotate(45deg); } 20% { opacity: 0.8; -webkit-transform: translate(0, -20%) rotate(45deg); transform: translate(0, -20%) rotate(45deg); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%) rotate(45deg); transform: translate(0, -1000%) rotate(45deg); } } @keyframes hearts { 0% { opacity: 0; -webkit-transform: translate(0, 0%) rotate(45deg); transform: translate(0, 0%) rotate(45deg); } 20% { opacity: 0.8; -webkit-transform: translate(0, -20%) rotate(45deg); transform: translate(0, -20%) rotate(45deg); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%) rotate(45deg); transform: translate(0, -1000%) rotate(45deg); } } @-webkit-keyframes lines { 0%, 50%, 100% { -webkit-transform: translateY(0%); transform: translateY(0%); } 25% { -webkit-transform: translateY(100%); transform: translateY(100%); } 75% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } } @keyframes lines { 0%, 50%, 100% { -webkit-transform: translateY(0%); transform: translateY(0%); } 25% { -webkit-transform: translateY(100%); transform: translateY(100%); } 75% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } } @-webkit-keyframes confetti { 0% { opacity: 0; -webkit-transform: translateY(0%) rotate(0deg); transform: translateY(0%) rotate(0deg); } 10% { opacity: 1; } 35% { -webkit-transform: translateY(-800%) rotate(270deg); transform: translateY(-800%) rotate(270deg); } 80% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(2000%) rotate(1440deg); transform: translateY(2000%) rotate(1440deg); } } @keyframes confetti { 0% { opacity: 0; -webkit-transform: translateY(0%) rotate(0deg); transform: translateY(0%) rotate(0deg); } 10% { opacity: 1; } 35% { -webkit-transform: translateY(-800%) rotate(270deg); transform: translateY(-800%) rotate(270deg); } 80% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(2000%) rotate(1440deg); transform: translateY(2000%) rotate(1440deg); } } @-webkit-keyframes fires { 0% { -webkit-transform: rotate(-70deg) translateY(0%); transform: rotate(-70deg) translateY(0%); } 25% { -webkit-transform: rotate(-20deg) translateY(-5%); transform: rotate(-20deg) translateY(-5%); opacity: 1; } 50% { -webkit-transform: rotate(-70deg) translateY(-10%); transform: rotate(-70deg) translateY(-10%); } 75% { -webkit-transform: rotate(-20deg) translateY(-20%); transform: rotate(-20deg) translateY(-20%); } 100% { -webkit-transform: rotate(-70deg) translateY(-40%); transform: rotate(-70deg) translateY(-40%); opacity: 1; } } @keyframes fires { 0% { -webkit-transform: rotate(-70deg) translateY(0%); transform: rotate(-70deg) translateY(0%); } 25% { -webkit-transform: rotate(-20deg) translateY(-5%); transform: rotate(-20deg) translateY(-5%); opacity: 1; } 50% { -webkit-transform: rotate(-70deg) translateY(-10%); transform: rotate(-70deg) translateY(-10%); } 75% { -webkit-transform: rotate(-20deg) translateY(-20%); transform: rotate(-20deg) translateY(-20%); } 100% { -webkit-transform: rotate(-70deg) translateY(-40%); transform: rotate(-70deg) translateY(-40%); opacity: 1; } } @-webkit-keyframes sunbeams { 0% { -webkit-transform: translateY(40%) rotate(0deg); transform: translateY(40%) rotate(0deg); } 50% { -webkit-transform: translateY(-40%) rotate(180deg); transform: translateY(-40%) rotate(180deg); } 100% { -webkit-transform: translateY(40%) rotate(360deg); transform: translateY(40%) rotate(360deg); } 0%,14%,17%,43%,53%,71%,80%,94%,100% { opacity: 0; } 6%,15%,24%,28%,48%,55%,78%,82%,99% { opacity: 1; } } @keyframes sunbeams { 0% { -webkit-transform: translateY(40%) rotate(0deg); transform: translateY(40%) rotate(0deg); } 50% { -webkit-transform: translateY(-40%) rotate(180deg); transform: translateY(-40%) rotate(180deg); } 100% { -webkit-transform: translateY(40%) rotate(360deg); transform: translateY(40%) rotate(360deg); } 0%,14%,17%,43%,53%,71%,80%,94%,100% { opacity: 0; } 6%,15%,24%,28%,48%,55%,78%,82%,99% { opacity: 1; } } /* 时间特效end */ ``` 第一步加组件 ``` { name: "", type: "timeData", coverImage: contextPath + "/images/componenttypes/" + locale + "/basic/zh_b1000.png", coverImageWidth: "50%", tip: "时间" } ``` 第二步添加核心代码 ``` vsPluginComponentModule.factory("$vcPlugin_basic_timeData", ["$vsPluginRegister", "$timeout", function (a, c) { var b = { showDataCategory: false, showBorderCategory: true, showBasicCategory: true, showFixedCategory: true, showEventCategory: false, showTitleCategory: false, buildDataDescription: function (e, h, g, d, f) { h.$on(event_refreshBindingData, function (k, l) { d.context.orgData = d.context.data; var i = d.config.datasourceConfig.dimensions; var j = d.config.datasourceConfig.measures; if (i && i.length > 0) { if (!j) { j = [] } h.queryModelData({ eventParam: l, dimensions: i, measures: j, tableKey: d.config.datasourceConfig.metadataConfig.metadataTable.key, onQuerySuccess: function (m) { if (m.data.success) { if (d.context.data == null || d.context.data.length == 0) { return } var o = {}; if (d.context.data != null && d.context.data.length > 0) { for (var n = 0; n < i.length; n++) { o[i[n].name] = d.context.data[0][i[n].name] } for (var n = 0; n < j.length; n++) { o[j[n].name] = d.context.data[0][j[n].name] } } c(function () { h.valueMap = o }) } else { toaster.error({ body: m.data.message }) } }, onError: function () { toaster.error({ body: vsLang.connection_failed }) } }) } }) }, buildChartDescription: function (j, h, e, g) { var d = { name: "text", title: vsLang.text, groups: [] }; e.description.categories.push(d); if (!e.config.is) { e.config.is = true; e.config.fontClass = ""; e.config.color = "#333333"; e.config.backgroundColor = "#FFFFFF"; e.config.textAlign = "left"; e.config.fontSize = 12 } if (j.component.config.showTitle == null) { j.component.config.showTitle = false } j.component = e; var f = []; f.push("<div id='fontclass' class='' style='height:100%;overflow:hidden;'><div ng-style=\"{'height':'100%', 'width':'100%', 'display': 'table'}\"><div id='content' ng-style=\"{'display': 'table-cell', 'vertical-align': 'middle', 'color':component.config.color, 'text-align':component.config.textAlign, 'font-size':component.config.fontSize+'px', 'font-weight':component.config.fontStyle.bold?'bold':'normal', 'font-style':component.config.fontStyle.italic?'italic':'normal', 'text-decoration':component.config.fontStyle.underline?'underline':'normal', 'font-family': component.config.tFontFamily.value, 'text-shadow': component.config.textShadowColor ? component.config.textShadowOffsetX+'px '+component.config.textShadowOffsetY+'px '+component.config.textShadowBlur+'px '+component.config.textShadowColor : 'none'}\" ></div></div></div>"); var i = g(f.join(""))(j); h.append(i); setInterval(function () { dt = new Date(); var show_day = new Array('星期一', '星期二', '星期三', '星期四', '星期五', '星期六', '星期日'); year = dt.getFullYear(); month = dt.getMonth() + 1; date = dt.getDate(); day = dt.getDay() - 1; hours = dt.getHours(); hours = hours < 10 ? "0" + hours : hours; minutes = dt.getMinutes(); minutes = minutes < 10 ? "0" + minutes : minutes; seconds = dt.getSeconds(); seconds = seconds < 10 ? "0" + seconds : seconds; dtime = year + "-" + month + "-" + date + " <br>" + hours + ":" + minutes + ":" + seconds + " " + show_day[day]; $('#' + e.id + ' #content').html(dtime); // console.log(dtime) }, 1000) console.log(e.config) // 时间特效 // ng-class 动态class 获取不到 没办法只能用替换class属性来实现 $('#' + e.id + ' #fontclass').attr('class', e.config.fontClass.value); function initparticles() { bubbles(); hearts(); lines(); confetti(); fire(); sunbeams(); } /*The measurements are ... whack (so to say), for more general text usage I would generate different sized particles for the size of text; consider this pen a POC*/ console.log($("#" + e.id + " .particletext>.bubbles")) function bubbles() { $.each($(".particletext.bubbles"), function () { $(this).remove(".particle"); var bubblecount = ($(this).width() / 50) * 10; console.log(bubblecount) for (var i = 0; i <= bubblecount; i++) { var size = ($.rnd(40, 80) / 10); console.log($(this)) $(this).append('<span class="particle" style="top:' + $.rnd(20, 80) + '%; left:' + $.rnd(0, 95) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + ($.rnd(0, 30) / 10) + 's;"></span>'); } }); } function hearts() { $.each($(".particletext.hearts"), function () { $(this).remove(".particle"); var heartcount = ($(this).width() / 50) * 5; for (var i = 0; i <= heartcount; i++) { var size = ($.rnd(60, 120) / 10); $(this).append('<span class="particle" style="top:' + $.rnd(20, 80) + '%; left:' + $.rnd(0, 95) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + ($.rnd(0, 30) / 10) + 's;"></span>'); } }); } function lines() { $.each($(".particletext.lines"), function () { $(this).remove(".particle"); var linecount = ($(this).width() / 50) * 10; for (var i = 0; i <= linecount; i++) { $(this).append('<span class="particle" style="top:' + $.rnd(-30, 30) + '%; left:' + $.rnd(-10, 110) + '%;width:' + $.rnd(1, 3) + 'px; height:' + $.rnd(20, 80) + '%;animation-delay: -' + ($.rnd(0, 30) / 10) + 's;"></span>'); } }); } function confetti() { $.each($(".particletext.confetti"), function () { $(this).remove(".particle"); $(this).remove(".c"); var confetticount = ($(this).width() / 50) * 10; for (var i = 0; i <= confetticount; i++) { $(this).append('<span class="particle c' + $.rnd(1, 2) + '" style="top:' + $.rnd(10, 50) + '%; left:' + $.rnd(0, 100) + '%;width:' + $.rnd(6, 8) + 'px; height:' + $.rnd(3, 4) + 'px;animation-delay: ' + ($.rnd(0, 30) / 10) + 's;"></span>'); } }); } function fire() { $.each($(".particletext.fire"), function () { $(this).remove(".particle"); var firecount = ($(this).width() / 50) * 20; for (var i = 0; i <= firecount; i++) { var size = $.rnd(8, 12); $(this).append('<span class="particle" style="top:' + $.rnd(40, 70) + '%; left:' + $.rnd(-10, 100) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + ($.rnd(0, 20) / 10) + 's;"></span>'); } }); } function sunbeams() { $.each($(".particletext.sunbeams"), function () { $(this).remove(".particle"); var linecount = ($(this).width() / 50) * 10; for (var i = 0; i <= linecount; i++) { $(this).append('<span class="particle" style="top:' + $.rnd(-50, 00) + '%; left:' + $.rnd(0, 100) + '%;width:' + $.rnd(1, 3) + 'px; height:' + $.rnd(80, 160) + '%;animation-delay: -' + ($.rnd(0, 30) / 10) + 's;"></span>'); } }); } jQuery.rnd = function (m, n) { m = parseInt(m); n = parseInt(n); return Math.floor(Math.random() * (n - m + 1)) + m; } initparticles(); // 特效end d.groups.push({ name: "text", title: { text: "效果" }, elements: [{ title: "效果", type: "select-s", bind: "fontClass", items: [{ name: "无效果", value: "" }, { name: "泡沫", value: "particletext bubbles" }, { name: "心形", value: "particletext hearts" }, { name: "线形", value: "particletext lines" }, { name: "五彩纸屑", value: "particletext confetti" }, { name: "火行", value: "particletext fire" }, { name: "阳光", value: "particletext sunbeams" }] }] }); d.groups.push({ name: "font", title: { text: vsLang.font }, elements: [{ title: vsLang.font_family, type: "fontFamily", bind: "tFontFamily" }, { title: vsLang.size, type: "configSlide", bind: "fontSize", config: { slideEnd: 100 } }, { title: vsLang.alignment, type: "horizontal-align", bind: "textAlign" }, { title: vsLang.font_color, type: "colorpicker", bind: "color" }, { title: vsLang.font_style, type: "font-style", bind: "fontStyle" } ] }); d.groups.push({ name: "text-shadow", title: { text: vsLang.text_shadow }, elements: [{ title: vsLang.color, type: "colorpicker", bind: "textShadowColor" }, { title: vsLang.width, type: "configSlide", bind: "textShadowBlur", config: { slideEnd: 20 } }, { title: vsLang.offset_x, type: "configSlide", bind: "textShadowOffsetX", config: { slideEnd: 20 } }, { title: vsLang.offset_y, type: "configSlide", bind: "textShadowOffsetY", config: { slideEnd: 20 } } ] }) j.$watch("component.config.fontClass", function (w, u) { var p = e.config; // console.log(w) p.fontClass = w; // ng-class 动态class 获取不到 没办法只能用替换class属性来实现 $('#' + e.id + ' #fontclass').attr('class', e.config.fontClass.value); initparticles(); }); } }; a.register("basic", "timeData", b); return null } ]); ``` 分享页 design.css 路径D:\ireport365\ireport365.war\WEB-INF\classes\report-resource\design.css ``` /* 五种时间文字特效 start*/ body .particletext { position: relative; } body .particletext.bubbles > .particle { opacity: 0; position: absolute; background-color: rgba(33, 150, 243, 0.5); -webkit-animation: bubbles 3s ease-in infinite; animation: bubbles 3s ease-in infinite; border-radius: 100%; } body .particletext.hearts > .particle { opacity: 0; position: absolute; background-color: #cc2a5d; -webkit-animation: hearts 3s ease-in infinite; animation: hearts 3s ease-in infinite; } body .particletext.hearts > .particle:before, body .particletext.hearts > .particle:after { position: absolute; content: ''; border-radius: 100px; top: 0px; left: 0px; width: 100%; height: 100%; background-color: #cc2a5d; } body .particletext.hearts > .particle:before { -webkit-transform: translateX(-50%); transform: translateX(-50%); } body .particletext.hearts > .particle:after { -webkit-transform: translateY(-50%); transform: translateY(-50%); } body .particletext.lines > .particle { position: absolute; background-color: rgba(244, 67, 54, 0.5); -webkit-animation: lines 3s linear infinite; animation: lines 3s linear infinite; } body .particletext.confetti > .particle { opacity: 0; position: absolute; -webkit-animation: confetti 3s ease-in infinite; animation: confetti 3s ease-in infinite; } body .particletext.confetti > .particle.c1 { background-color: rgba(76, 175, 80, 0.5); } body .particletext.confetti > .particle.c2 { background-color: rgba(156, 39, 176, 0.5); } body .particletext.fire > .particle { position: absolute; background-color: rgba(255, 193, 7, 0.5); border-radius: 40px; border-top-right-radius: 0px; -webkit-animation: fires 0.8s linear infinite; animation: fires 0.8s linear infinite; -webkit-transform: rotate(-45deg); transform: rotate(-45deg); opacity: 0; } body .particletext.fire > .particle:before { position: absolute; content: ''; top: 60%; left: 40%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); width: 50%; height: 50%; border-radius: 40px; border-top-right-radius: 0px; background-color: rgba(251, 140, 0, 0.5); } body .particletext.sunbeams > .particle { position: absolute; background-color: rgba(253, 216, 53, 0.5); -webkit-animation: sunbeams 3s linear infinite; animation: sunbeams 3s linear infinite; } @-webkit-keyframes bubbles { 0% { opacity: 0; } 20% { opacity: 1; -webkit-transform: translate(0, -20%); transform: translate(0, -20%); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%); transform: translate(0, -1000%); } } @keyframes bubbles { 0% { opacity: 0; } 20% { opacity: 1; -webkit-transform: translate(0, -20%); transform: translate(0, -20%); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%); transform: translate(0, -1000%); } } @-webkit-keyframes hearts { 0% { opacity: 0; -webkit-transform: translate(0, 0%) rotate(45deg); transform: translate(0, 0%) rotate(45deg); } 20% { opacity: 0.8; -webkit-transform: translate(0, -20%) rotate(45deg); transform: translate(0, -20%) rotate(45deg); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%) rotate(45deg); transform: translate(0, -1000%) rotate(45deg); } } @keyframes hearts { 0% { opacity: 0; -webkit-transform: translate(0, 0%) rotate(45deg); transform: translate(0, 0%) rotate(45deg); } 20% { opacity: 0.8; -webkit-transform: translate(0, -20%) rotate(45deg); transform: translate(0, -20%) rotate(45deg); } 100% { opacity: 0; -webkit-transform: translate(0, -1000%) rotate(45deg); transform: translate(0, -1000%) rotate(45deg); } } @-webkit-keyframes lines { 0%, 50%, 100% { -webkit-transform: translateY(0%); transform: translateY(0%); } 25% { -webkit-transform: translateY(100%); transform: translateY(100%); } 75% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } } @keyframes lines { 0%, 50%, 100% { -webkit-transform: translateY(0%); transform: translateY(0%); } 25% { -webkit-transform: translateY(100%); transform: translateY(100%); } 75% { -webkit-transform: translateY(-100%); transform: translateY(-100%); } } @-webkit-keyframes confetti { 0% { opacity: 0; -webkit-transform: translateY(0%) rotate(0deg); transform: translateY(0%) rotate(0deg); } 10% { opacity: 1; } 35% { -webkit-transform: translateY(-800%) rotate(270deg); transform: translateY(-800%) rotate(270deg); } 80% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(2000%) rotate(1440deg); transform: translateY(2000%) rotate(1440deg); } } @keyframes confetti { 0% { opacity: 0; -webkit-transform: translateY(0%) rotate(0deg); transform: translateY(0%) rotate(0deg); } 10% { opacity: 1; } 35% { -webkit-transform: translateY(-800%) rotate(270deg); transform: translateY(-800%) rotate(270deg); } 80% { opacity: 1; } 100% { opacity: 0; -webkit-transform: translateY(2000%) rotate(1440deg); transform: translateY(2000%) rotate(1440deg); } } @-webkit-keyframes fires { 0% { -webkit-transform: rotate(-70deg) translateY(0%); transform: rotate(-70deg) translateY(0%); } 25% { -webkit-transform: rotate(-20deg) translateY(-5%); transform: rotate(-20deg) translateY(-5%); opacity: 1; } 50% { -webkit-transform: rotate(-70deg) translateY(-10%); transform: rotate(-70deg) translateY(-10%); } 75% { -webkit-transform: rotate(-20deg) translateY(-20%); transform: rotate(-20deg) translateY(-20%); } 100% { -webkit-transform: rotate(-70deg) translateY(-40%); transform: rotate(-70deg) translateY(-40%); opacity: 1; } } @keyframes fires { 0% { -webkit-transform: rotate(-70deg) translateY(0%); transform: rotate(-70deg) translateY(0%); } 25% { -webkit-transform: rotate(-20deg) translateY(-5%); transform: rotate(-20deg) translateY(-5%); opacity: 1; } 50% { -webkit-transform: rotate(-70deg) translateY(-10%); transform: rotate(-70deg) translateY(-10%); } 75% { -webkit-transform: rotate(-20deg) translateY(-20%); transform: rotate(-20deg) translateY(-20%); } 100% { -webkit-transform: rotate(-70deg) translateY(-40%); transform: rotate(-70deg) translateY(-40%); opacity: 1; } } @-webkit-keyframes sunbeams { 0% { -webkit-transform: translateY(40%) rotate(0deg); transform: translateY(40%) rotate(0deg); } 50% { -webkit-transform: translateY(-40%) rotate(180deg); transform: translateY(-40%) rotate(180deg); } 100% { -webkit-transform: translateY(40%) rotate(360deg); transform: translateY(40%) rotate(360deg); } 0%,14%,17%,43%,53%,71%,80%,94%,100% { opacity: 0; } 6%,15%,24%,28%,48%,55%,78%,82%,99% { opacity: 1; } } @keyframes sunbeams { 0% { -webkit-transform: translateY(40%) rotate(0deg); transform: translateY(40%) rotate(0deg); } 50% { -webkit-transform: translateY(-40%) rotate(180deg); transform: translateY(-40%) rotate(180deg); } 100% { -webkit-transform: translateY(40%) rotate(360deg); transform: translateY(40%) rotate(360deg); } 0%,14%,17%,43%,53%,71%,80%,94%,100% { opacity: 0; } 6%,15%,24%,28%,48%,55%,78%,82%,99% { opacity: 1; } } /* 时间特效end */ ``` 路径:D:\ireport365\ireport365.war\WEB-INF\classes\report-resource\design.js 添加到text基本文字组件下面 ``` // 时间组件 case "timeData": var html = []; html.push("<div id='fontclass' class='particletext lines' style='height:100%;overflow:hidden;'><div ng-style=\"{'height':'100%', 'width':'100%', 'display': 'table'}\"><div id='content' ng-style=\"{'display': 'table-cell', 'vertical-align': 'middle', 'color':component.config.color, 'text-align':component.config.textAlign, 'font-size':component.config.fontSize+'px', 'font-weight':component.config.fontStyle.bold?'bold':'normal', 'font-style':component.config.fontStyle.italic?'italic':'normal', 'text-decoration':component.config.fontStyle.underline?'underline':'normal', 'font-family': component.config.tFontFamily.value, 'text-shadow': component.config.textShadowColor ? component.config.textShadowOffsetX+'px '+component.config.textShadowOffsetY+'px '+component.config.textShadowBlur+'px '+component.config.textShadowColor : 'none'}\" >&nbsp;&nbsp;&nbsp;&nbsp;</div></div></div>"); var el = $compile(html.join(""))(scope); element.append(el); // console.log(scope.component.id) setInterval(function(){ dt = new Date(); var show_day=new Array('星期一','星期二','星期三','星期四','星期五','星期六','星期日'); year=dt.getFullYear(); month=dt.getMonth()+1; date=dt.getDate(); day=dt.getDay()-1; hours=dt.getHours(); hours=hours<10?"0"+hours:hours; minutes=dt.getMinutes(); minutes=minutes<10?"0"+minutes:minutes; seconds=dt.getSeconds(); seconds=seconds<10?"0"+seconds:seconds; dtime = year+"-"+month+"-"+date+" <br>"+hours+":"+minutes+":"+seconds+" "+show_day[day]; $('#'+scope.component.id+' #content').html(dtime); // console.log(dtime) },1000) // 时间特效 // 只能用jq的方式动态添加class ng-class不支持 element.find('#fontclass').attr('class',scope.component.config.fontClass.value) var rnd = function(m,n) { m = parseInt(m); n = parseInt(n); return Math.floor( Math.random() * (n - m + 1) ) + m; } function initparticles() { bubbles(); hearts(); lines(); confetti(); fire(); sunbeams(); } initparticles(); /*The measurements are ... whack (so to say), for more general text usage I would generate different sized particles for the size of text; consider this pen a POC*/ function bubbles() { $.each($(".particletext.bubbles"), function(){ $(this).remove(".particle"); var bubblecount = ($(this).width()/50)*10; for(var i = 0; i <= bubblecount; i++) { var size = (rnd(40,80)/10); console.log($(this)) $(this).append('<span class="particle" style="top:' + rnd(20,80) + '%; left:' + rnd(0,95) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + (rnd(0,30)/10) + 's;"></span>'); } }); } function hearts() { $.each($(".particletext.hearts"), function(){ $(this).remove(".particle"); var heartcount = ($(this).width()/50)*5; for(var i = 0; i <= heartcount; i++) { var size = (rnd(60,120)/10); $(this).append('<span class="particle" style="top:' + rnd(20,80) + '%; left:' + rnd(0,95) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + (rnd(0,30)/10) + 's;"></span>'); } }); } function lines() { $.each($(".particletext.lines"), function(){ $(this).remove(".particle"); var linecount = ($(this).width()/50)*10; for(var i = 0; i <= linecount; i++) { $(this).append('<span class="particle" style="top:' + rnd(-30,30) + '%; left:' + rnd(-10,110) + '%;width:' + rnd(1,3) + 'px; height:' + rnd(20,80) + '%;animation-delay: -' + (rnd(0,30)/10) + 's;"></span>'); } }); } function confetti() { $.each($(".particletext.confetti"), function(){ $(this).remove(".particle"); $(this).remove(".c"); var confetticount = ($(this).width()/50)*10; for(var i = 0; i <= confetticount; i++) { $(this).append('<span class="particle c' + rnd(1,2) + '" style="top:' + rnd(10,50) + '%; left:' + rnd(0,100) + '%;width:' + rnd(6,8) + 'px; height:' + rnd(3,4) + 'px;animation-delay: ' + (rnd(0,30)/10) + 's;"></span>'); } }); } function fire() { $.each($(".particletext.fire"), function(){ $(this).remove(".particle"); var firecount = ($(this).width()/50)*20; for(var i = 0; i <= firecount; i++) { var size = rnd(8,12); $(this).append('<span class="particle" style="top:' + rnd(40,70) + '%; left:' + rnd(-10,100) + '%;width:' + size + 'px; height:' + size + 'px;animation-delay: ' + (rnd(0,20)/10) + 's;"></span>'); } }); } function sunbeams() { $.each($(".particletext.sunbeams"), function(){ $(this).remove(".particle"); var linecount = ($(this).width()/50)*10; for(var i = 0; i <= linecount; i++) { $(this).append('<span class="particle" style="top:' + rnd(-50,00) + '%; left:' + rnd(0,100) + '%;width:' + rnd(1,3) + 'px; height:' + rnd(80,160) + '%;animation-delay: -' + (rnd(0,30)/10) + 's;"></span>'); } }); } // 效果end scope.$on(event_refreshBindingData, function(target, param) { var dimensions = component.config.datasourceConfig.dimensions; var measures = component.config.datasourceConfig.measures; if (!measures) { measures = [] } if (dimensions && dimensions.length > 0) { scope.queryModelData({ eventParam: param, dimensions: dimensions, measures: measures, tableKey: component.config.datasourceConfig.metadataConfig.metadataTable.key, onQuerySuccess: function(response) { if (response.data.success) { var valueMap = {}; if (component.context.data != null && component.context.data.length > 0 && component.context.data[0] != null) { for (var i = 0; i < dimensions.length; i++) { valueMap[dimensions[i].name] = component.context.data[0][dimensions[i].name] } for (var i = 0; i < measures.length; i++) { valueMap[measures[i].name] = component.context.data[0][measures[i].name] } } $timeout(function() { scope.valueMap = valueMap }) } else { console.log({ body: response.data.message }) } }, onError: function() { console.log({ body: vsLang.connection_failed }) } }) } }); break; // 时钟 start ```