joint实现s形时间轴大事记代码
代码语言:html
所属分类:其他
代码描述:joint实现s形时间轴大事记代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en" > <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/joint.3.7.2.css"> <style> #paper-container { position: absolute; right: 0; top: 0; left: 0; bottom: 0; overflow: scroll; } #logo { position: absolute; bottom: 20px; right: 20px; background-color: #ffffff; border: 1px solid #d3d3d3; padding: 5px; box-shadow: 2px 2px 2px 1px rgba(0, 0, 0, 0.3); } </style> </head> <body translate="no"> <div id="paper-container"></div> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/lodash.4.17.21.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/jquery.3.6.0.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/backbone-min.js"></script> <script type="text/javascript" src="//repo.bfw.wiki/bfwrepo/js/joint.3.7.2.js"></script> <script > const { dia, shapes: defaultShapes, util, connectors } = joint; const shapes = { ...defaultShapes }; // Paper const paperContainer = document.getElementById("paper-container"); const graph = new dia.Graph({}, { cellNamespace: shapes }); const paper = new dia.Paper({ model: graph, cellViewNamespace: shapes, width: "100%", gridSize: 20, async: true, sorting: dia.Paper.sorting.APPROX, defaultConnector: { name: 'curve' }, defaultConnectionPoint: { name: 'anchor' }, background: { color: '#fff' } }); paperContainer.appendChild(paper.el); // Color palette const colors = ['#557ac5','#7593d0','#d9e1f2','#ecf0f9','#b73e66','#2CA58D', '#FEFEFE']; // Underline hyperlinks on hover paper.svg.appendChild( V.createSVGStyle(` .event-link:hover text { text-decoration: underline; } `) ); const eventMarkup = util.svg` <rect @selector="dateBackground"/> <text @selector="date"/> <path @selector="body"/> <a class="event-link" @selector="link"> <text @selector="label"/> </a> `; class Event extends dia.Element { defaults() { return { ...super.defaults, type: 'Event', z: 1, attrs: { root: { magnetSelector: 'body' }, body: { d: 'M 10 0 H calc(w-10) A 10 10 0 0 1 calc(w) 10 V calc(h-30) H 10 A 10 10 0 0 1 0 calc(h-40) V 10 A 10 10 0 0 1 10 0 Z', strokeWidth: 2, rx: 5, ry: 5, fill: colors[1], stroke: colors[0], }, label: { fontFamily: 'sans-serif', fontSize: 15, x: 'calc(w/2)', y: 'calc(h/2 - 15)', textAnchor: 'middle', textVerticalAnchor: 'middle', lineHeight: 24, textWrap: { width: -10, height: null }, fill: colors[6], }, date: { fontFamily: 'sans-serif', fontSize: 14, x: 'calc(w - 30)', y: 'calc(h - 15)', textAnchor: 'middle', textVerticalAnchor: 'middle', fill: colors[5] }, dateBackground: { width: 60, height: 40, x: 'calc(w - 60)', y: 'calc(h - 40)', stroke: colors[2], fill: colors[6], strokeWidth: 1, rx: 10, ry: 10 }, link: { xlinkShow: 'new', cursor: 'pointer' } } }; } preinitialize() { this.markup = eventMarkup; } } shapes.Event = Event; function createEvent(text, date, url) { return new Event({ size: { width: 150, height: 110 }, year: date.getFullYear(), attrs: { label: { text, }, date: { // Format date as "Jan 1" text: date.toLocaleString('default', { month: 'short', day: 'numeric' }), }, link: { xlinkHref: url } } }); } function createLink(source, target) { return new shapes.standard.Link({ source: { id: source.id }, target: { id: target.id }, z: 2, attrs: { line: { stroke: colors[4], strokeWidth: 3, } } }); } const events = [ // 2015 // Introducing OpenAI // December 11, 2015 — Announcements // https://openai.com/blog/introducing-openai/ createEvent('Introducing OpenAI', new Date('12/11/2015'), 'https://openai.com/'), // 2016 // OpenAI Gym Beta // April 27, 2016 — Research // https://openai.com/blog/openai-gym-beta/ createEvent('OpenAI Gym Beta', new Date('04/27/2016'), 'https://openai.com/'), // Universe // December 5, 2016 — Research // https://openai.com/blog/universe/ createEvent('Universe', new Date('12/05/2016'), 'https://openai.com/'), // 2017 // Proximal Policy Optimization // July 20, 2017 — Research, Milestones // https://openai.com/blog/openai-baselines-ppo/ createEvent('Proximal Policy Optimization', new Date('07/20/2017'), 'https://openai.com'), // Dota 2 // August 11, 2017 — Research, OpenAI Five // https://openai.com/blog/dota-2/ createEvent('Dota 2', new Date('08/11/2017'), 'https://openai.com'), // 2018 // Preparing for Malicious Uses of AI // February 20, 2018 — Research // https://openai.com/blog/preparing-for-malicious-uses-of-ai/ createEvent('Preparing for Malicious Uses of AI', new Date('02/20/2018'), 'https://openai.com'), // OpenAI Charter // April 9, 2018 — Announcements, Milestones // https://openai.com/blog/openai-charter/ createEvent('OpenAI Charter', new Date('04/09/2018'), 'https://openai.com/'), // Learning Dexterity // July 30, 2018 — Research, Milestones // https://openai.com/blog/learning-dexterity/ createEvent('Learning Dexterity', new Date('07/30/2018'), 'https://openai.com/'), // 2019 // Better Language Models and Their Implications // February 14, 2019 — Research, Milestones, GPT-2 // https://openai.com/blog/better-language-models/ createEvent('Better Language Models and Their Implications', new Date('02/14/2019'), 'https://openai.com/'), // OpenAI LP // March 11, 2019 — Announcements // https://openai.com/blog/openai-lp/ createEvent('OpenAI LP', new Date('03/11/2019'), 'https://openai.com/'), // OpenAI Five Defeats Dota 2 World Champions // April 15, 2019 — Research, OpenAI Five // https://openai.com/blog/openai-five-defeats-dota-2-world-champions/ createEvent('OpenAI Five Defeats Dota 2 World Champions', new Date('04/15/2019'), 'https://openai.com/'), // MuseNet // April 25, 2019 — Research, Milestones // https://openai.com/blog/musenet/ createEvent('MuseNet', new Date('04/25/2019'), 'https://openai.com/'), // Microsoft Invests In and Partners with // OpenAI to Support Us Building Beneficial AGI // July 22, 2019 — Announcements // https://openai.com/blog/microsoft/ createEvent('Microsoft Invests In and Partners with OpenAI to Support Us Building Beneficial AGI', new Date('07/22/2019'), 'https://openai.com/'), // GPT-2: 6-Month Follow-Up // August 20, 2019 — Research, GPT-2 // https://openai.com/blog/gpt-2-6-month-follow-up/ createEvent('GPT-2: 6-Month Follow-Up', new Date('08/20/2019'), 'https://openai.com/blog/'), // Emergent Tool Use from Multi-Agent Interaction // September 17, 2019 — Research, Milestones // https://openai.com/blog/emergent-tool-use/ createEvent('Emergent Tool Use from Multi-Agent Interaction', new Date('09/17/2019'), 'https://openai.com/'), // Solving Rubik’s Cube with a Robot Hand // October 15, 2019 — Research, Milestones // https://openai.com/blog/solving-rubiks-cube/ createEvent('Solving Rubik’s Cube with a Robot Hand', new Date('10/15/2019'), 'https://openai.com/'), // GPT-2: 1.5B Release // November 5, 2019 — Research, GPT-2 // https://openai.com/blog/gpt-2-1-5b-release/ createEvent('GPT-2: 1.5B Release', new Date('11/05/2019'), 'https://openai.com/'), // 2020 // Jukebox // April 30, 2020 — Research, Milestones // https://openai.com/blog/jukebox/ createEvent('Jukebox', new Date('04/30/2020'), 'https://openai.com/'), // OpenAI API // June 11, 2020 — API, Announcements // https://openai.com/blog/openai-api/ createEvent('OpenAI API', new Date('06/11/2020'), 'https://openai.com/'), // 2021 // CLIP: Connecting Text and Images // January 5, 2021 — Research, Milestones, M // https://openai.com/blog/clip/ createEvent('CLIP: Connecting Text and Images', new Date('01/05/2021'), 'https://openai.com/'), // DALL·E: Creating Images from Text // January 5, 2021 — Research, Milestones, Multimodal // https://openai.com/blog/dall-e/ createEvent('DALL·E: Creating Images from Text', new Date('01/05/2021'), 'https://opena.........完整代码请登录后点击上方下载按钮下载查看
网友评论0