Skip to content

Instantly share code, notes, and snippets.

define([], function() {
return function(update) {
var windowAspectRatio = window.innerWidth/window.innerHeight,
isMobile = /Android|webOS|iPhone|iPad|iPod|BlackBerry/.test(navigator.userAgent);
// console.log(windowAspectRatio);
var scrollYAtScan = 0,
// screenMeasure = windowAspectRatio < 0.7 && isMobile ? 0.8 : 0.5; // measurement point for page progress - 0.5 = vertical center of the window.
<script>
var width = 960,
height = 500;
var randomX = d3.random.normal(width / 2, 80),
randomY = d3.random.normal(height / 2, 80);
var data = d3.range(2000).map(function() {
return [
var totalLength = path.node().getTotalLength();
path
.attr("stroke-dasharray", totalLength + " " + totalLength)
.attr("stroke-dashoffset", totalLength)
.transition()
.duration(2000)
.ease("linear")
.attr("stroke-dashoffset", 0);
<!--- HTML AND SVG --->
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
width="340px" height="333px" viewBox="0 0 340 333" enable-background="new 0 0 340 333" xml:space="preserve">
<path class="path" fill="#FFFFFF" stroke="#000000" stroke-width="4" stroke-miterlimit="10" d="M66.039,133.545c0,0-21-57,18-67s49-4,65,8
s30,41,53,27s66,4,58,32s-5,44,18,57s22,46,0,45s-54-40-68-16s-40,88-83,48s11-61-11-80s-79-7-70-41
C46.039,146.545,53.039,128.545,66.039,133.545z"/>
</svg>
d3.timer(function() {
var angle = velocity * (Date.now() - then);
canvas.each(function(i) {
var rotate = [0, 0, 0], context = this.getContext("2d");
rotate[i] = angle, projection.rotate(rotate);
context.clearRect(0, 0, diameter, diameter);
context.beginPath(), path.context(context)(land), context.fill();
context.beginPath(), path(globe), context.stroke();
});
});
@jugalpatel803
jugalpatel803 / stumpo.js
Created April 22, 2016 22:43
stumpos algorithms
var tickChanger = fl.add(config, "tick")
tickChanger.onChange(function(value) {
value ? force.start() : force.stop()
})
var frictionChanger = fl.add(config, "friction", 0, 1)
frictionChanger.onChange(function(value) {
force.friction(value)
force.start()
})
@jugalpatel803
jugalpatel803 / widget.js
Created April 15, 2016 17:24
Grouped layers w/ layers reversed
startup: function() {
this.inherited(arguments);
NlsStrings.value = this.nls;
// summary:
// this function will be called when widget is started.
// description:
// according to webmap or basemap to create LayerInfos instance
// and initialize operLayerInfos;
// show layers list;
// bind events for layerLis;
@jugalpatel803
jugalpatel803 / widget.js
Last active April 15, 2016 17:20
Grouped layers w/ layers not reversed
startup: function() {
this.inherited(arguments);
NlsStrings.value = this.nls;
// summary:
// this function will be called when widget is started.
// description:
// according to webmap or basemap to create LayerInfos instance
// and initialize operLayerInfos;
// show layers list;
// bind events for layerLis;
@jugalpatel803
jugalpatel803 / widget.js
Created April 11, 2016 19:04
Grouped Layers in ArcGIS
startup: function() {
this.inherited(arguments);
NlsStrings.value = this.nls;
// summary:
// this function will be called when widget is started.
// description:
// according to webmap or basemap to create LayerInfos instance
// and initialize operLayerInfos;
// show layers list;
// bind events for layerLis;
@jugalpatel803
jugalpatel803 / widget.js
Created April 1, 2016 19:37
Customize Layer List Widget for ArcGIS Web App Builder
//begin grouping feature layers for rooms and labels
if (this.map.itemId) {
LayerInfos.getInstance(this.map, this.map.itemInfo)
.then(lang.hitch(this, function(operLayerInfos) {
this.operLayerInfos = operLayerInfos;
//create feature collections (groups) from feature layers