Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pixel painter complete #67

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
54 changes: 0 additions & 54 deletions README.md

This file was deleted.

85 changes: 85 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
// create grid
function createGrid() {
for (var i = 0; i < 2024; i++) {
$('.grid').append('<div class="pixel"></div>')
}
}

createGrid()


// paint colors
$('.paint').click(function() {
$(this).css('border', 'transparent').siblings().removeAttr('style');

var currentColor = $(this).css('background-color');
$('.current-color-box').removeAttr('style').css('background-color', currentColor);

$('.pixel').mousedown(function() {
$(this).css('background', currentColor).css('border', 'transparent');

$('.pixel').bind('mousemove', function() {
$(this).css('background', currentColor).css('border', 'transparent');
})
})

$('.pixel').mouseup(function() {
$('.pixel').unbind('mousemove');
})

})

// color picker
$('.eyedrop').click(function() {
$(this).css('transform', 'scale(1.3, 1.3)').siblings().removeAttr('style')

$('.color-picker').show()

$('#click').click(function() {
var pickedColor = $('#colorInput').val();

$('.current-color-box').removeAttr('style').css('background-color', pickedColor);

$('.pixel').mousedown(function() {
$(this).css('background', pickedColor).css('border', 'transparent');

$('.pixel').bind('mousemove', function() {
$(this).css('background', pickedColor).css('border', 'transparent');
})
})

$('.pixel').mouseup(function() {
$('.pixel').unbind('mousemove');
})
})

$('.close').click(function() {
$('.color-picker').hide()
$('.eyedrop').removeAttr('style')
})
})

// erase
$('.erase').click(function() {
$(this).css('transform', 'scale(1.3, 1.3)').siblings().removeAttr('style')

$('.current-color-box').removeAttr('style').css('background-image', 'linear-gradient(-16deg, transparent, transparent 48%, red 49%, red 51%, transparent 52%, transparent)');

$('.pixel').mousedown(function() {
$(this).removeAttr('style');

$('.pixel').bind('mousemove', function() {
$(this).removeAttr('style');
})
})

$('.pixel').mouseup(function() {
$('.pixel').unbind('mousemove');
})
})

// delete
$('.delete').click(function() {
$('.current-color-box').removeAttr('style').css('background-image', 'linear-gradient(-16deg, transparent, transparent 48%, red 49%, red 51%, transparent 52%, transparent)');
$('.pixel').removeAttr('style');
})
48 changes: 48 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<!DOCTYPE html>
<html lang="en">
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.4.min.js"></script>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="style.css" />
<title>Paint by Pixels</title>
</head>
<body>

<div class="container">
<div class="board">

<div class="palette">
<div class="colors">
<div class="color-circle paint darkred"></div><div class="color-circle paint red"></div><div class="color-circle paint red-orange"></div>
<div class="color-circle paint yellow"></div><div class="color-circle paint yellow-orange"></div><div class="color-circle paint orange"></div>
<div class="color-circle paint yellow-green"></div><div class="color-circle paint lime"></div><div class="color-circle paint green"></div>
<div class="color-circle paint blue"></div><div class="color-circle paint lightblue"></div><div class="color-circle paint turquoise"></div>
<div class="color-circle paint darkblue"></div><div class="color-circle paint darkpurple"></div><div class="color-circle paint purple"></div>
<div class="color-circle paint magenta"></div><div class="color-circle paint pink"></div><div class="color-circle paint lavender"></div>
<div class="color-circle paint beige"></div><div class="color-circle paint tan"></div><div class="color-circle paint brown"></div>
<div class="color-circle paint white"></div><div class="color-circle paint gray"></div><div class="color-circle paint black"></div>
<div class="color-picker">
<div class="close"><i class="fa fa-times-circle" aria-hidden="true"></i></div>
<input type="text" id="colorInput" placeholder="Enter color">
<button id="click">Set</button>
</div>
<div class="color-circle icon eyedrop"><i class="fa fa-eyedropper" aria-hidden="true"></i></div>
<div class="color-circle icon erase"><i class="fa fa-eraser" aria-hidden="true"></i></div>
<div class="color-circle icon delete"><i class="fa fa-trash" aria-hidden="true"></i></div>
</div>
<div class="current-color">
<div class="current-color-box"></div>
</div>
</div>

<div class="artboard">
<div class="grid"></div>
</div>

</div>
</div>


<script type="text/javascript" src="app.js"></script>
</body>
</html>
Binary file removed pixel-art-maker-alt.png
Binary file not shown.
Binary file removed pixel-art-maker.png
Binary file not shown.
Loading